killercup / killercup/cargo-edit

Allow to filter packages by registry, when upgrading them

Open
#964 1 comment 0 reactions 0 assignees View on GitHub
cargo-upgrade
Dominant language
Rust
Stars
3.5k
Forks
166
PR merge metrics
No merged PRs in 30d

Description

### Problem statement

When working with private cargo registries I want to be able to scope packages I want to upgrade to ones from specific registry.

For example if at work I use private registry for internal libraries I would want to upgrade internal libraries separately from crates.io dependencies. Such ability would be especially useful in CI to automatically create issues or PRs when internal library has new version released.

### Proposal

I want to add `--registry` flag to `cargo-upgrade` (in dependencies section). It should take as an argument a `` which is defined in `[registries]` table in [cargo configuration](https://doc.rust-lang.org/cargo/reference/config.html#registries). By specifying this flag only crates from this registry will be considered when running any `cargo-upgrade` commands. The flag can be passed multiple times to specify a list of registries.

### Open Questions

- [ ] How to allow enabling default registry? Should `--registry` flag treat `crates-io` as a special value? Or maybe there should be `--default-registry` flag?
- [ ] How should this work together with [source replacement](https://doc.rust-lang.org/cargo/reference/source-replacement.html)?
- [ ] Should sources defined in [`source..registry`](https://doc.rust-lang.org/cargo/reference/config.html#sourcenameregistry) be allowed as `--registry` flag values?

### Prior art

I am not aware of any cargo plugin, which would allow for filtering on registry basis.

Tracking issue for upgrades in the `cargo` upstream also does not include such functionality (see https://github.com/rust-lang/cargo/issues/12425). Although in the end I think this should be added to the upstream, it is probably better to implement this here first.

### Implementation

If this issue gets accepted, I am ready to implement it.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the cargo-upgrade dependency commands and Cargo's registry and source-replacement configuration documented in the issue. Resolve the open questions about crates.io, source replacements, and allowed registry values, then define behavior for repeated --registry flags across all cargo-upgrade commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.