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

cargo publish should default to alt registry if defined in Cargo.toml #8036

Closed
lily-mara opened this issue Mar 24, 2020 · 1 comment · Fixed by #8571
Closed

cargo publish should default to alt registry if defined in Cargo.toml #8036

lily-mara opened this issue Mar 24, 2020 · 1 comment · Fixed by #8571
Labels
A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-publish

Comments

@lily-mara
Copy link

When working with multiple Rust projects, some private and some public, it can be frustrating to remember where each package needs to be published. Currently, cargo publish defaults to crates.io. This is a great default for public packages that will be used across the community. However, many companies want to use private Rust packages for writing internal tools/libraries.

Currently, Cargo.toml supports the lib.publish field to limit publishing to one or more registries. This prevents cargo from publishing private packages to crates.io, which is a great feature. I propose a slight augmentation to cargo publish's default behavior. If Cargo.toml's lib.publish field contains a single registry, then cargo publish should default to publishing to this registry. This makes the default publish command cargo publish for every package, no matter where it's being published to.

The "single value" limitation could also be lifted, and cargo publish could publish to every registry defined in the lib.publish field, but that seems like more of a surprise than this.

@lily-mara lily-mara added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Mar 24, 2020
@lily-mara lily-mara changed the title cargo publish should default to alt registry if defined in Cargo.toml cargo publish should default to alt registry if defined in Cargo.toml Mar 24, 2020
@repi
Copy link

repi commented Jun 16, 2020

This would indeed be a nice ergonomic improvement, to not require specifying --registry <registry-name> to cargo publish for every crate when one has a single registry for the crate.

We frequently also publish our internal crates to a private registry (EmbarkStudios/rust-ecosystem#10) and all of our internal crates have a single lib.publish field in them to specify that this is the only registry we allow publishing to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-registries Area: registries C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-publish
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants