Skip to content
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

Use semver version for dependencies. #27

Closed
wants to merge 1 commit into from

Conversation

jaudiger
Copy link

I prefer the usage of semver as version constraining for crates. Since they can relax a bit the usage of dependencies in project using this crate.

@nickelc
Copy link

nickelc commented Mar 10, 2023

Caret requirements are the default strategy, ^1.2.3 is exactly equivalent to 1.2.3.

@jaudiger jaudiger force-pushed the use_semver_version branch from 210a893 to 68ebee7 Compare March 10, 2023 21:12
@jaudiger
Copy link
Author

Right. I removed the caret syntax.

For further reference (https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html):

1.2.3  :=  >=1.2.3, <2.0.0
1.2    :=  >=1.2.0, <2.0.0
1      :=  >=1.0.0, <2.0.0
0.2.3  :=  >=0.2.3, <0.3.0
0.2    :=  >=0.2.0, <0.3.0
0.0.3  :=  >=0.0.3, <0.0.4
0.0    :=  >=0.0.0, <0.1.0
0      :=  >=0.0.0, <1.0.0

@jaudiger
Copy link
Author

The CI is now green. This PR is ready to be reviewed @fdncred

@sholderbach
Copy link
Member

sholderbach commented Mar 11, 2023

As I said in nushell/nushell#8407 this can be an actively bad practice.
The version range specified for a dependency by Cargo.toml should have as a lower bound a known validated version that satisfies all requirements of what this library depends on.
For the upper bound it would be great if it is semver compatible with the most recent version.
Furthermore in the range of versions between the lower and upper bound there shouldn't be a known bug in non-yanked releases for the features we use.

In the dependency tree of someone consuming our library there could be someone pinning to an exact version that is not satisfying our requirements (if not precisely specified) but allowed by relaxed version specifiers leading to a broken build instead of - in this case necessary - dependency duplication.

For an in depth discussion of the problem of minimal version a timely discussion in Jon Gjengset's video on good crate stewardship: https://www.youtube.com/watch?v=xUH-4y92jPg&t=1476s

cc @fdncred

@jaudiger
Copy link
Author

jaudiger commented Mar 11, 2023

@sholderbach Thanks for your in depth explanation! I already saw a few videos from Jon Gjengset, I will watch your suggestion tonight. Anyway, in order, to not introduce bad practices, and to not create a nightmare for people using this library, I'll close this PR.

@jaudiger jaudiger closed this Mar 11, 2023
@jaudiger jaudiger deleted the use_semver_version branch May 17, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants