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

Option to disable installation with install #13699

Closed
vertesians opened this issue Apr 4, 2024 · 4 comments
Closed

Option to disable installation with install #13699

vertesians opened this issue Apr 4, 2024 · 4 comments
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-install S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@vertesians
Copy link

Problem

Some crates require extra processing that cargo install cannot provide even with build scripts (e.g., fish-shell/fish-shell#10181), causing them to be broken without warning.

Proposed Solution

Provide a config option on a bin that prevents it from being installed with cargo install, with an error message telling the user to refer to the crate's documentation or repository instead. Maybe also provide a flag that forces an install with a warning.

Notes

No response

@vertesians vertesians added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-triage Status: This issue is waiting on initial triage. labels Apr 4, 2024
@epage
Copy link
Contributor

epage commented Apr 4, 2024

Could you help me understand what would be the point of publishing the bin package if it isn't meant to be installed?

@weihanglo weihanglo added S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. and removed S-triage Status: This issue is waiting on initial triage. labels Apr 4, 2024
@vertesians
Copy link
Author

vertesians commented Apr 7, 2024

Could you help me understand what would be the point of publishing the bin package if it isn't meant to be installed?

It's nice to have projects up on crates.io since it's how many Rust users discover crates in the first place. And I think not publishing a crate would make other things difficult, like putting code documentation up on docs.rs.

It's extra awkward with crates that are both bins and libraries, though I suppose you could make a separate unpublished crate for the bin... but that feels hacky.

@epage
Copy link
Contributor

epage commented Apr 9, 2024

It's nice to have projects up on crates.io since it's how many Rust users discover crates in the first place. And I think not publishing a crate would make other things difficult, like putting code documentation up on docs.rs.

If you have a lib, that makes sense. If you are using crates.io to post a bin for the sake of advertising, that sounds more like a hack than anything else.

It's extra awkward with crates that are both bins and libraries, though I suppose you could make a separate unpublished crate for the bin... but that feels hacky.

Not hacky and there are lots of good reasons to split bins and libs into separate packages, for example

You can also use package.exclude to exclude the bin from being included in the .crate if you don't have an explicit [[bin]] table. #13713 proposes changing cargo to automatically remove those [[bin]] tables.

@vertesians
Copy link
Author

@epage Hmm. Okay, I see what you mean, and I'm convinced. Closing the issue.

@vertesians vertesians closed this as not planned Won't fix, can't repro, duplicate, stale Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` Command-install S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants