-
-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ranges in spec #1232
Allow ranges in spec #1232
Conversation
docs/src/compatibility.md
Outdated
|
||
```toml | ||
[compat] | ||
PkgA = "0.1 - 0.2.3" # [0.1.0, 0.2.3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not what a range should mean: the second end-point should be inclusive, and any unspecified trailing numbers should be considered to be wildcards. I.e.
0.1-0.2.3
means[0.1, 0.2.3]
0.1-0.2
means[0.1, 0.3)
0.1-0
means[0.1, 1.0)
This seems to be what you've implemented, but it would be good to have some tests and, of course, the comment here should be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking a look. I didn't notice the ) vs the ]. I just copied and pasted from the doc above.
Did you see the tests already in the commit? I am not really familiar with semver, so if you could recommend any additional tests, that would be helpful.
Hi @fredrikekre, would you mind clarifying whether you are thumbs-downing the feature, or the implementation? |
Is it really so annoying to list all breaking versions you are compatible with? |
@fredrikekre, why the thumbs down? If I have to guess it's that you don't want to support range syntax in compat sections. The current situation where we have non-overlapping syntaxes for version specs in the registry and in the compat section is a bit of a mess and this fixes at least half of that. We should have a single syntax for specifying version sets that works everywhere. We can encourage/discourage using certain parts of the syntax in different places, but having different syntaxes in different places seems awful to me. |
@fredrikekre I don't know if it's annoying. So that I can get a better idea of what you mean, can you tell me how I would specify: |
[compat]
StaticArrays = "0.5.3, 0.6, 0.7, 0.8, 0.9, 0.10" In this case it becomes a bit long, but it should be really unusual to support more than one, maybe two breaking versions of a dependency, so the list will normally don't be that long. |
I suppose I don't really understand why there are two syntaxes, either. Why isn't there exactly one way to specify a set of versions? Is it because semver on its own can't specify arbitrary sets of versions? So then, if that's the case, then there's some other syntax required for specifying arbitrary sets of versions. I think I'd understand if this feature required introducing new syntax. But it doesn't. It uses the same parsing code that's used elsewhere. |
The "semver syntax"—which isn't actually specified in the semver standard at all—has many different redundant syntaxes, like However, people wanted the normal semver syntax that other languages use for writing compatibility constraints, so that was implemented—without supporting the range syntax, which is a less common syntax in other languages. So that's how we have ended up here: the registry format only supports version range syntax, while the compat section only supports tilde, carrot and equality specifications of version sets. We cannot break things, so that precludes removing support either syntax in order to unify things, which leaves supporting all of these syntaxes in all places as the only way to unify. |
There are just one user-facing syntax. The range syntax used in the Registry is an implementation detail. |
It’s a very public “implementation detail”. |
I thought I had tested my last commit, but it was broken. This should be correctly tested now. That said, I think I'm still missing some concepts. I would be happy to add some documentation in a separate PR if I understood.
And then there's julia> Pkg.Types.semver_spec("1.2.3")
VersionSpec("1.2.3-1")
julia> Pkg.Types.VersionSpec("1.2.3")
VersionSpec("1.2.3") |
I don't understand the new |
I don't know what julia> Pkg.Types.semver_spec("v1.2.3") # maintain existing behavior of semver_spec
VersionSpec("1.2.3-1")
julia> Pkg.Types.VersionRange("v1.2.3")
VersionRange("1.2.3")
julia> Pkg.Types.VersionSpec(Pkg.Types.VersionRange("v1.2.3")) # this would be the wrong thing to return from semver_spec("v1.2.3")
VersionSpec("1.2.3")
julia> Pkg.Types.VersionRange("v1.2.3"; force_range=true)
ERROR: ArgumentError: degenerate version range: "v1.2.3" |
Ah, ok. This is related to the fact that by default |
This would be a great feature to have. What is blocking from it to be merged?
Don't you need to still support it during Julia 1.x? If that's the case, isn't the decision to deprecate it or not orthogonal to this PR? |
In what way? A bot writes it, Pkg consumes it. It should never be touched by humans because getting the compression correct by hand is very hard. If people need to change bounds of existing versions in the registry we should have an API along the lines of Trying to unify the compressed format of the registry and the compat specification will in my opinion only lead to confusion.
It was very much intentional that the simplest way to write a compa entry that is semver compatible with
I oppose this to the extremest degree :) |
|
Regarding this PR, I don't think it should change the Lines 340 to 345 in dfb341a
should be added that matches the hyphen syntax and creates the correct Something like adding an entry
and the function |
Obsoleted by #1410 |
Attempt at addressing #843