{"id":15994688,"url":"https://github.com/taiki-e/cargo-minimal-versions","last_synced_at":"2025-04-05T19:12:43.249Z","repository":{"id":38196076,"uuid":"330212742","full_name":"taiki-e/cargo-minimal-versions","owner":"taiki-e","description":"Cargo subcommand for proper use of -Z minimal-versions and -Z direct-minimal-versions.","archived":false,"fork":false,"pushed_at":"2024-10-24T11:27:23.000Z","size":267,"stargazers_count":46,"open_issues_count":7,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-10-25T10:27:27.255Z","etag":null,"topics":["cargo","cli","rust","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taiki-e.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"taiki-e"}},"created_at":"2021-01-16T17:03:43.000Z","updated_at":"2024-10-24T11:27:25.000Z","dependencies_parsed_at":"2023-02-19T17:46:11.875Z","dependency_job_id":"c22338c3-051b-4d0e-9f98-85a746c545c3","html_url":"https://github.com/taiki-e/cargo-minimal-versions","commit_stats":{"total_commits":131,"total_committers":2,"mean_commits":65.5,"dds":0.03053435114503822,"last_synced_commit":"6fc9972e26a203413a1c2ea29b97785f77df4963"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fcargo-minimal-versions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fcargo-minimal-versions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fcargo-minimal-versions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taiki-e%2Fcargo-minimal-versions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taiki-e","download_url":"https://codeload.github.com/taiki-e/cargo-minimal-versions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247386265,"owners_count":20930619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo","cli","rust","testing"],"created_at":"2024-10-08T07:09:50.455Z","updated_at":"2025-04-05T19:12:43.205Z","avatar_url":"https://github.com/taiki-e.png","language":"Rust","funding_links":["https://github.com/sponsors/taiki-e"],"categories":[],"sub_categories":[],"readme":"# cargo-minimal-versions\n\n[![crates.io](https://img.shields.io/crates/v/cargo-minimal-versions?style=flat-square\u0026logo=rust)](https://crates.io/crates/cargo-minimal-versions)\n[![license](https://img.shields.io/badge/license-Apache--2.0_OR_MIT-blue?style=flat-square)](#license)\n[![github actions](https://img.shields.io/github/actions/workflow/status/taiki-e/cargo-minimal-versions/ci.yml?branch=main\u0026style=flat-square\u0026logo=github)](https://github.com/taiki-e/cargo-minimal-versions/actions)\n\nCargo subcommand for proper use of [`-Z minimal-versions`][cargo#5657] and [`-Z direct-minimal-versions`][direct-minimal-versions].\n\n- [Usage](#usage)\n  - [--direct (-Z direct-minimal-versions)](#--direct--z-direct-minimal-versions)\n- [Details](#details)\n- [Installation](#installation)\n- [Related Projects](#related-projects)\n- [License](#license)\n\n## Usage\n\n\u003cdetails\u003e\n\u003csummary\u003eComplete list of options (click to show)\u003c/summary\u003e\n\n\u003c!-- readme-long-help:start --\u003e\n```console\n$ cargo minimal-versions --help\ncargo-minimal-versions\n\nCargo subcommand for proper use of -Z minimal-versions and -Z direct-minimal-versions.\n\nUSAGE:\n    cargo minimal-versions \u003cCARGO_SUBCOMMAND\u003e [OPTIONS] [CARGO_OPTIONS]\n\nCARGO_SUBCOMMANDS:\n    build\n    check\n    test\n    ...\n```\n\u003c!-- readme-long-help:end --\u003e\n\n\u003c/details\u003e\n\nTo check all crates with minimal version dependencies:\n\n```sh\ncargo minimal-versions check --workspace\n```\n\n\u003e [!NOTE]\n\u003e ([If cargo-minimal-versions determined that it is necessary to do so for a correct minimal versions check](#details)) cargo-minimal-versions modifies `Cargo.toml` and `Cargo.lock` while running and restores it when finished. Any changes you made to those files during running will not be preserved.\n\nNormally, crates with `publish = false` do not need minimal versions check. You can skip these crates by using `--ignore-private` flag.\n\n```sh\ncargo minimal-versions check --workspace --ignore-private\n```\n\nIf path dependencies exist, the above ways may miss the problem when you publish the crate (e.g., [tokio-rs/tokio#4376], [tokio-rs/tokio#4490]) \u003cbr\u003e\nBy using `--detach-path-deps` flag, you can run minimal versions check with `path` fields removed from dependencies.\n\n```sh\ncargo minimal-versions check --workspace --ignore-private --detach-path-deps\n```\n\n`--detach-path-deps` (`--detach-path-deps=all`) flag removes all[^1] `path` fields by default.\nBy using `--detach-path-deps=skip-exact` flag, you can skip the removal of `path` fields in dependencies with exact version requirements (`\"=\u003cversion\u003e\"`). For example, this is useful for [a pair of a proc-macro and a library that export it](https://github.com/taiki-e/pin-project/blob/v1.1.5/Cargo.toml#L28).\n\n[^1]: To exactly, when neither `version`, `git`, nor `path` field is specified, an error will occur, so we will remove the `path` field of all of dependencies for which have `version` or `git` field.\n\n### --direct (-Z direct-minimal-versions)\n\nIf there are dependencies that are incompatible with `-Z minimum-versions`, it is also reasonable to use [`-Z direct-minimal-versions`][direct-minimal-versions], since it is hard to maintain `-Z minimum-versions` compatibility in such situations.\n\nBy using `--direct` flag, cargo-minimal-versions uses `-Z direct-minimal-versions` instead of `-Z minimal-versions`.\n\n```sh\ncargo minimal-versions check --direct\n```\n\n\u003e [!NOTE]\n\u003e Using `-Z direct-minimal-versions` may miss some of the problems that can be found when using `-Z minimal-versions`. However, if there is a problem only in a particular version of a dependency, a problem that was missed when using `-Z minimal-versions` may be found by using `-Z direct-minimal-versions` (because the resolved dependency version is different).\n\n## Details\n\nUsing `-Z minimal-versions` in the usual way will not work properly in many cases. [To use `cargo check` with `-Z minimal-versions` properly, you need to run at least three processes.](https://github.com/tokio-rs/tokio/pull/3131#discussion_r521621961)\n\n\u003e If I remember correctly, `cargo check -Z minimal-versions` doesn't really do anything. It needs to be separated into `cargo update -Z minimal-versions` and `cargo check`.\n\u003e\n\u003e Also, dev-dependencies may raise version requirements. Ideally, remove them before run `cargo update -Z minimal-versions`. (Also, note that `Cargo.lock` is actually shared within the workspace. However as far as I know, there is no workaround for this yet.)\n\nIn addition, due to cargo's feature integration, it is not correct to run `cargo check` or `cargo build` with `-p` (`--package`) or `--workspace` (`--all`) or on virtual manifest. To handle this problem correctly, you need the workspace handling provided by subcommands such as [`cargo hack`][cargo-hack].\n\ncargo-minimal-versions addresses most of these issues and makes it easy to run cargo commands with `-Z minimal-versions`.\n\nSee [#1](https://github.com/taiki-e/cargo-minimal-versions/issues/1) and [#6](https://github.com/taiki-e/cargo-minimal-versions/issues/6) for the remaining problems.\n\n## Installation\n\n\u003c!-- omit in toc --\u003e\n### Prerequisites\n\ncargo-minimal-versions requires nightly\ntoolchain (to run `cargo update -Z minimal-versions` or `cargo update -Z direct-minimal-versions`) and [cargo-hack] (to run `cargo check` \u0026 `cargo build` proper):\n\n```sh\nrustup toolchain add nightly\ncargo +stable install cargo-hack --locked\n```\n\n\u003c!-- omit in toc --\u003e\n### From source\n\n```sh\ncargo +stable install cargo-minimal-versions --locked\n```\n\nCurrently, installing cargo-minimal-versions requires rustc 1.70+.\n\ncargo-minimal-versions is usually runnable with Cargo versions older than the Rust version\nrequired for installation (e.g., `cargo +1.59 minimal-versions check`).\n\n\u003c!-- omit in toc --\u003e\n### From prebuilt binaries\n\nYou can download prebuilt binaries from the [Release page](https://github.com/taiki-e/cargo-minimal-versions/releases).\nPrebuilt binaries are available for macOS, Linux (gnu and musl), Windows (static executable), FreeBSD, and illumos.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample of script to install from the Release page (click to show)\u003c/summary\u003e\n\n```sh\n# Get host target\nhost=$(rustc -vV | grep '^host:' | cut -d' ' -f2)\n# Download binary and install to $HOME/.cargo/bin\ncurl --proto '=https' --tlsv1.2 -fsSL \"https://github.com/taiki-e/cargo-minimal-versions/releases/latest/download/cargo-minimal-versions-$host.tar.gz\" \\\n  | tar xzf - -C \"$HOME/.cargo/bin\"\n```\n\n\u003c/details\u003e\n\n\u003c!-- omit in toc --\u003e\n### On GitHub Actions\n\nYou can use [taiki-e/install-action](https://github.com/taiki-e/install-action) to install prebuilt binaries on Linux, macOS, and Windows.\nThis makes the installation faster and may avoid the impact of [problems caused by upstream changes](https://github.com/tokio-rs/bytes/issues/506).\n\n```yaml\n- uses: taiki-e/install-action@cargo-hack\n- uses: taiki-e/install-action@cargo-minimal-versions\n```\n\n\u003c!-- omit in toc --\u003e\n### Via Homebrew\n\nYou can install cargo-minimal-versions from the [Homebrew tap maintained by us](https://github.com/taiki-e/homebrew-tap/blob/HEAD/Formula/cargo-minimal-versions.rb) (x86_64/AArch64 macOS, x86_64/AArch64 Linux):\n\n```sh\nbrew install taiki-e/tap/cargo-minimal-versions\n```\n\n\u003c!-- omit in toc --\u003e\n### Via Scoop (Windows)\n\nYou can install cargo-minimal-versions from the [Scoop bucket maintained by us](https://github.com/taiki-e/scoop-bucket/blob/HEAD/bucket/cargo-minimal-versions.json):\n\n```sh\nscoop bucket add taiki-e https://github.com/taiki-e/scoop-bucket\nscoop install cargo-minimal-versions\n```\n\n\u003c!-- omit in toc --\u003e\n### Via cargo-binstall\n\nYou can install cargo-minimal-versions using [cargo-binstall](https://github.com/cargo-bins/cargo-binstall):\n\n```sh\ncargo binstall cargo-minimal-versions\n```\n\n## Related Projects\n\n- [cargo-hack]: Cargo subcommand to provide various options useful for testing and continuous integration.\n- [cargo-llvm-cov]: Cargo subcommand to easily use LLVM source-based code coverage.\n- [cargo-config2]: Library to load and resolve Cargo configuration.\n\n[cargo-config2]: https://github.com/taiki-e/cargo-config2\n[cargo-hack]: https://github.com/taiki-e/cargo-hack\n[cargo-llvm-cov]: https://github.com/taiki-e/cargo-llvm-cov\n[cargo#5657]: https://github.com/rust-lang/cargo/issues/5657\n[direct-minimal-versions]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#direct-minimal-versions\n[tokio-rs/tokio#4376]: https://github.com/tokio-rs/tokio/pull/4376\n[tokio-rs/tokio#4490]: https://github.com/tokio-rs/tokio/pull/4490\n\n## License\n\nLicensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or\n[MIT license](LICENSE-MIT) at your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fcargo-minimal-versions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaiki-e%2Fcargo-minimal-versions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaiki-e%2Fcargo-minimal-versions/lists"}