-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Encourage the use of the repository field in Cargo.toml #14139
Comments
Another important reason for the @LawnGnome looking for your input on the value of this from a provenance perspective and for input from a crates-io team perspective on how much we should push this on the Cargo side vs the crates-io side. |
btw I'm not a fan of adding a lot of boiletplate for It would be tempting to say "default to origin" but if the repo is new (the likely case), origin might not be set. Its most if its a workspace without |
I like the idea, but the new repo case is definitely a valid issue here. 100% thinking out loud here, but instead of doing this upon package creation, could we instead have
From the crates.io side, the thing I'm planning to propose at this stage would be exposing the rev alongside the repository if we have a Beyond that, I don't foresee any crates.io side changes that would make sense here. It feels like any new behaviour here to encourage |
The one idea I had was requiring the repository field though I left things open in case other ideas could come up. Likely there are reasons not to but figured it would be worth at least considering. |
I think that's more prescriptive than we really want to be on the package registry, honestly: if a crate maintainer doesn't use a VCS in general, or Git in particular, that's really their business and not ours. I don't think we'd want to prevent someone from publishing just because of that. |
If I am not mistaken there is no requirement in crates.io for a crate to be open source. In that case most likely it won't have public VCS either. Crates.io probably should warn about this, but if this is to be allowed then the |
To be precise, crates on crates.io are all distributed as source code 1. They are free to distribute under any license, not limited to OSI-approved open source license. Besides, having a public accessible VCS is not necessarily a requirement of being “open source”. Footnotes
|
Problem
Having the
repository
field in Cargo.toml of an open source Rust project will make it easier to contribute to the project.According to my analysis on Rust-Digger, 19.03% of the crates don't have the
repository
field.Some of those ~ 2.23% use the
homepage
field to link to the repository. It is better than nothing, but ideally people would use the repository field. See stats: https://rust-digger.code-maven.com/statsProposed Solution
Adding
to the generated
Cargo.toml
file will probably encourage more people to enable it and use it to link to the repository.In addition including a commented out link to the documentation of the manifest would also help https://doc.rust-lang.org/cargo/reference/manifest.html
Finally,
cargo publish
might give a warning if the repository field is missing or if it is emptyNotes
No response
The text was updated successfully, but these errors were encountered: