-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Pre-release version numbers #2222
Comments
Specifically, if I put
|
Yes, Cargo should follow SemVer here. I think that this might be the fault of the |
Ok, sorting should be fixed, but that’s separate from the original issue. |
Well, given that |
Let me rephrase. Let’s say a package has three versions published: 1.0.0, 1.0.1, and 1.1.0-beta. If I depend on it with version requirement Or, more generally, should we assign meaning (and tool behavior) other than the relative ordering to "pre-release"? |
That is exactly what I am speaking about in #2222 (comment) |
From the same paragraph that you quoted:
Precedence is not what I’m talking about. This part of paragraph 9 is relevant to what I’m talking about, though:
Should Cargo consider 1.1.0-beta incompatible with 1.0.0 in the same way that 2.0.0 is incompatible with 1.0.0? (Whereas 1.1.0 is compatible with 1.0.0.) |
As far as I'm aware, Cargo's notion of "compatible with x.y" is just |
I.e. since "compatible with 1.0" is |
No. It’s |
Or rather something like |
Er, sorry, yes, you are correct (4AM here...). But my point still stands. |
I agree with @SimonSapin that it seems odd if I say "semver compatible with 1.0.0" that I'll start picking up I agree that there also may be an issue with the semver crate which needs to be handled as well, especially if we consider |
Two things that I think are somewhat uncontroversial:
I'd like to suggest canonizing the concept of channels, so that:
The idea is to make the Rust-style release cycle more first class and give people a way, through their Cargo.toml, of subscribing to a particular "release channel". We could also make subscription explicit through additional metadata: [dependencies.nix]
version = "1.3.0"
channel = "beta" This would always select the latest betathat also matches the semver versioning ( |
What do you mean by supersedes? “ Note that semver.org only talks about precedence, “how versions are compared to each other when ordered”. And 1.3.0-beta does sort after 1.2.0.
Would there be a list of allowed keywords? semver.org allows arbitrary identifiers for pre-release versions. |
Precisely.
Arbitrary identifiers for channels would be allowed, but you could only upgrade across versions on the same "channel". In practice, it is probably good to stick to a few well-known names like "nightly", "alpha", "beta", "rc", but they would not be interpreted as having any relation to each other across versions. Just like in Rust, if you subscribe to the "beta" channel, you stick to beta. |
One thing we'd need to figure out is what to do when we see a request like: foo = "1.0.2-beta2" That's valid by today's rules, but should that only match the package |
I'm not seeing the behavior that's being talked about in the beginning of the post. In particular, cargo seems to not select prerelease versions at all? Specifying a dependency core_rustc-serialize = "*" (or core_rustc-serialize = "^0.3") results in Cargo choosing 0.3.19, while it should choose the newer 0.3.20-v0.3.19patch1. You can't specify 0.3.20-v0.3.19patch1 in either case by using cargo update --precise. Specifying the exact version string does work. I don't see any code changes linked here that suggest the behavior has changed though. It seems people in here want cargo to not automatically update to higher prerelease versions, e.g. if the spec is "^0.3.19", it wouldn't update to "0.3.20-alpha". I understand that sentiment, but I think cargo should allow manually updating to that version in this case by using |
In general, it shouldn't select prerelease versions unless you explicitly ask for prerelease versions. |
When I did
this broke my build! https://semver.org/#spec-item-11 says:
So cargo should not "update" from |
if 0.2.0-beta is less than 0.2.0, can't it update? |
@Lokathor It's less but not semver compatible. It's a breaking change. |
I just ran into this: I had |
@matthiasbeyer that sounds like the opposite of this issue, and a bug if > cargo tree -i rustbreak
Updating crates.io index
rustbreak v2.0.0-rc3
└── foo v0.1.0 (/tmp/tmp.6sQUs3MEK6/foo)
> cargo add rustbreak --vers 2.0.0
Updating 'https://github.com/rust-lang/crates.io-index' index
Adding rustbreak v2.0.0 to dependencies
> cargo tree -i rustbreak
Updating crates.io index
rustbreak v2.0.0
└── foo v0.1.0 (/tmp/tmp.6sQUs3MEK6/foo) |
Well, okay. Maybe messed up somehow in the heat of the moment. Never mind! 😆 |
I had a problem recently with a published binary (see #9999). I published cargo-temp v0.2.3 using clap |
I just noticed now that leftwm-theme has the exact same issue! https://github.com/leftwm/leftwm-theme imo this clearly shows that this is a pitfall |
There was a discussion in the internals forum here: https://internals.rust-lang.org/t/changing-cargo-semver-compatibility-for-pre-releases/14820/10?u=djc. The preferred suggestion seemed to be this:
Cargo team, does that need an RFC, or just an implementation? |
I think that will need a detailed description of how people opt in to the breaking change. |
Okay, here are two directions that we could work out more. Option 1: reuse the resolver = "3" Option 2: separate value: pre-release-updates = "sticky" # or "default" |
Strike again, rwf2/Rocket#2166, I think a small fix could be that cargo consider by defaut that pre release is for exact version edit: #2222 (comment) I'm blind sorry for spamming. @djc option 1 seem way better than option 2 cause option 2 require the user to always put this in every cargo.toml file, while "resolver = "3" is a naturel way to just update semver rule, and can be set by default in edition 2024. |
Rfc proposition rust-lang/rfcs#3263 my first ever ! hope it's ok |
As this is a more stable place to be holding this conversation, I'm moving a thread over from rust-lang/rfcs#3263 @ehuss said
@epage said
@ehuss said
|
Its number of places and chance for errors (tracking what the requirements should be).
Its hard to gauge how much a feature would be used if it had better support. I minimized my use of it for clap v4 and I didn't bother switching my version requirements for the few pre-releases I did do, hoping I wouldn't have a breaking change affected by this, because I didn't want to deal with the version requirement clean up.
I hope we can come to a better solution for handling of pre-releases than comment directives.
While channels might be useful in some contexts, I doubt they can generally resolve this problem. A lot of pre-release testing is more one off; people aren't as likely to continually want to do pre-release testing unless they are patching their crates to get ahead of time notice, like people testing nightlies in CI.
imo this is a non-starter. If clap v3 had to have a separate channel for each pre-release breaking change, we would have run out of well-recognized channel names. I had brought this up in one of the other threads that we cannot assume semver compatibility even within the same pre-release type as it doesn't make sense to constrain compatibility on that axis. |
Should Cargo do something special when a dependency has versions published with pre-release version numbers? Maybe not select them unless requested explicitly with
cargo update --precise
?CC whitequark/rust-xdg#9, @whitequark, @alexcrichton
The text was updated successfully, but these errors were encountered: