mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-07 00:00:09 +02:00
1.5 KiB
1.5 KiB
How to specify crates dependencies versions
Each crate (e.g., tokio-util, tokio-stream, etc.) should specify dependencies
according to the following rules:
- The listed version should be the oldest version that the crate works with
(e.g., if
tokio-utilworks withtokioversion1.44but not1.43, thentokio-utilshould specify version1.44for itstokiodependency). We don't require users to use the latest version unnecessarily. - When a crate starts using a newer feature in a dependency, the version should be bumped to the version that introduced it.
- If a crate depends on an unreleased feature in a dependency, it may use
path =dependency to specify this. Since path dependencies must be removed during the release of the crate, this ensures that it can't be released until the dependency has a new version.
Consider the following example from tokio-stream:
[dependencies]
futures-core = { version = "0.3.0" }
pin-project-lite = "0.2.11"
tokio = { version = "1.38.0", path = "../tokio", features = ["sync"] }
In this case, local development of tokio-stream uses the local version
of tokio via the path dependency. This means that it's currently not
possible to release tokio-stream, and tokio should be released first.
Once a new version of tokio is released (in this example the 1.38.0),
the path dependency should be removed.
As mentioned before, this version should only be bumped when adding a new
feature in the crate that relies on a newer version.