{"id":16911532,"url":"https://github.com/timonpost/cargo-dependency-inheritor","last_synced_at":"2025-08-18T12:16:21.976Z","repository":{"id":59781877,"uuid":"539171429","full_name":"TimonPost/cargo-dependency-inheritor","owner":"TimonPost","description":"Utility to inherit dependencies from workspace file if it occurs 'n' or more times throughout the project.","archived":false,"fork":false,"pushed_at":"2023-03-14T13:26:08.000Z","size":52,"stargazers_count":31,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T10:38:09.417Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/TimonPost.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2022-09-20T20:04:01.000Z","updated_at":"2024-12-04T00:40:47.000Z","dependencies_parsed_at":"2024-10-28T13:15:40.109Z","dependency_job_id":"e9274079-5e42-4026-b1c5-ec210ca08f62","html_url":"https://github.com/TimonPost/cargo-dependency-inheritor","commit_stats":{"total_commits":36,"total_committers":3,"mean_commits":12.0,"dds":0.4444444444444444,"last_synced_commit":"67f33677c755bf9a14cfa3eca5066c32324c9075"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Fcargo-dependency-inheritor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Fcargo-dependency-inheritor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Fcargo-dependency-inheritor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimonPost%2Fcargo-dependency-inheritor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimonPost","download_url":"https://codeload.github.com/TimonPost/cargo-dependency-inheritor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244943993,"owners_count":20536290,"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":[],"created_at":"2024-10-13T19:06:29.000Z","updated_at":"2025-03-22T10:31:56.969Z","avatar_url":"https://github.com/TimonPost.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cargo Workspace Dependency Inheritor\n\nUtility that inherits dependencies from the main workspace if they occur `n` or more times in the workspace.\n\nWorkspace Inheritance was stabilized in version 1.64.\nSee [`[workspace.package]`][1], [`[workspace.dependencies]`][2], and [inheriting-a-dependency-from-a-workspace][3] for more information.\n\n## How to Use\n\nTo inherit a dependency that occurs five or more times in the workspace, use the following command:\n\n```bash\ncargo install cargo-dependency-inheritor\ncargo dependency-inheritor --workspace-path \"path/to/workspace/Cargo.toml\" -n 5\n```\n\n**This command edits your toml files, make sure to have a back up**\n\n## Process\n\nDependencies can be inherited from a workspace by specifying the dependency in the workspace's [`[workspace.dependencies]`][2] table. After that, add it to the `[dependencies]` table with workspace = true.\nThis crate automates the process.\n\n1. Read packages defined in `[workspace]` section of the workspace-file.\n2. Note which dependencies occur `n` or more times.\n3. Update all dependencies that occurred `n` or more times:\n   1. Turn `dependency = \"0.1.3\"` into inline tables.\n   2. Add `workspace = true` key-value to the dependency inline table.\n   3. Remove `version` from inline table if exists (this will be specified in the workspace file).\n4. Add [`[workspace.dependencies]`][2] table to root workspace file with all the dependencies that occurred `n` times and their version.\n\nResult:\n\n```toml\n# in a project\n[dependencies]\ntokio = { workspace = true }\n\n# in the workspace\n[workspace.dependencies]\ntokio = \"1.0\"\n```\n\n[1]: https://doc.rust-lang.org/nightly/cargo/reference/workspaces.html#the-package-table\n[2]: https://doc.rust-lang.org/nightly/cargo/reference/workspaces.html#the-dependencies-table\n[3]: https://doc.rust-lang.org/nightly/cargo/reference/specifying-dependencies.html#inheriting-a-dependency-from-a-workspace\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimonpost%2Fcargo-dependency-inheritor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimonpost%2Fcargo-dependency-inheritor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimonpost%2Fcargo-dependency-inheritor/lists"}