Currently we allow v"1"
as shorthand for v"1.0.0"
and such, but this is a bit confusing and in Pkg3 omitted trailing version numbers will actually be version sets matching any version with the specified prefix. Should we deprecate this and require spelling out the zeros? One issue is that we still want v"1.2.3"
to mean a specific version number while in Pkg3 it's a pattern matching that prefix.
Maybe Pkg3 should use something more explicit like v"1.*"
to match all 1-versions?
If this is deprecated, it would be good to also have a more permissive version parser, since I find it quite useful to convert "foreign" version numbers (e.g. from Python packages) into VersionNumber
so that I can use functions like <
on them. (See also #7282.)
But maybe this could go into a ParseVersions package?
Maybe Pkg3 should use something more explicit like
v"1.*"
to match all 1-versions?
It appears a lot in registry files. Those extra two characters would add up _really_ quickly; when I tried printing version bounds like this, it was a lot of visual noise and obscured the meaning considerably.
Even if we did that, v"1"
would still look pretty ambiguous 鈥撀爄s that the same as v"1.0.0"
or v"1.*"
? The former seems more surprising than the latter, so even if I can see requiring v"1.*"
for writing a version pattern in code, I still think that requiring explicit trailing zeros in version numbers would be better. Then you would have to write v"1.0.0"
for the version number and v"1.*"
for the pattern. I do like requiring the stars for pattern literals, since it naturally distinguishes the version v"1.2.3"
from the pattern v"1.2.3/*"
(exact syntax tbd).
If this is deprecated, it would be good to also have a more permissive version parser
Agree, that is really useful and there's currently an unfortunate tension between wanting to be strict with Julia's internal version number syntax and wanting to be lenient when parsing external version numbers.
something more explicit like
v"1.*"
A related option (which includes both this possibility as well as simply v"1"
) is the semver format npm uses (brief description here, with more details here). It seems rust also uses the same syntax to specify dependencies. I like it generally, but for the life of me I can never confidently remember the difference between ^
and ~
without looking it up.
EDIT: In any case, it would be nice if the syntax here is at least consistent with npm syntax, even if Pkg3 chooses only to implement a subset of the allowed syntax.
Hyphen ranges and *
ranges make sense and would be compatible. The other range types seem confusing and unnecessary.
Most helpful comment
Maybe Pkg3 should use something more explicit like
v"1.*"
to match all 1-versions?