-
Notifications
You must be signed in to change notification settings - Fork 148
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
Merge cargo-rm into cargo #682
Comments
Currently:
Only operates on one crate The positional argument is list of dependency keys to remove Cleans up features when done |
Out of scope: Too immature Move to cargo: Fix before merging |
(Python) poetry remove
(Javascript) yarn remove
(Javascript) pnpm remove (Go) go get
(Julia) pkg rm (Ruby) bundle remove (Dart) dart pub remove |
Hello! Per some conversations with @epage, I will be working on this feature for the time being. I'll start leaving my notes on this issue as well. |
Expanded list of prior art: (Python) poetry remove
(JavaScript) yarn remove
(JavaScript) pnpm remove (Go) go get
(Julia) pkg rm
(Ruby) bundle remove (Dart) dart pub remove
(Lua) luarocks remove
(.NET) Uninstall-Package
(Haxe) haxelib remove (Racket) raco pkg remove
|
Happen to know what distinguishes a force-remove from a remove? I'm also a bit baffled as to why some tools provide an |
If another dependency depends on the package to be removed, it seems the default behavior in these programs would be to raise an error. A force remove disregards that error, and removes the package anyway. I'm pretty confident this behavior wouldn't exist in Cargo, since removing a dependended-upon crate from the manifest would still keep the dependency in the graph, just not as a top-level dependency. That being said, it would be good to know whether there are any edge cases in which removing a dependency could result in a dependency resolution issue.
I thought it was weird too! My intuition here is that it could be useful in some sort of interactive environment, like a REPL. Looking at the original PR for |
Right now, we always remove even if it is a known breaking change. I wonder if we the following cases should require force-remove
|
That makes sense to me.
Good to know. I suppose if any progress is made on that front, we could revisit this? |
I'm assuming |
Do you think breaking changes should be considered opt-in (with For that matter, adding a dependency can in some cases result in a breaking change, so I worry that it runs the risk of setting a precedent that we can't actually uphold. |
If we have the feature at all, I feel like it should be
How so? |
It's definitely more of a hard-to-detect edge case, but from the SemVer docs:
|
When #711 is merged, the |
After #712 is merged, I will open another pull request for cargo rm dry run. |
I'm going to start keeping track of my own task list here:
|
Starting to work on |
That's fine! I will update the task list. I'll let you know if I have any questions. |
rust-lang/cargo#10902 is moving forward, so we should do similar (part of #698) Also, should we GC |
Okay! Sounds good. Is that something that we should do before or after
By this, do you mean having the What do you think about a |
Whereever possible, we should make changes before forking so people can use them immediately and there is less "going dark". In this case, you can use
In general, we have to weigh
Flags come with a usability cost. The So with that, we need to consider if the feature is worth the cost of a flag. In some cases, it might be better to not have the functionality at all. In other cases, it might be better to make it unconfigurable. In this particular case, some things to keep in mind
Other options
btw |
That makes sense to me. Since this will probably be in |
Title: Import cargo-remove into cargo What does this PR try to resolve?This PR merges Motivation
With rust-lang/cargo#10472, cargo-add was added to cargo. As part of that discussion, it was also proposed that Drawbacks
Behavior
Note: like Note: Help output$ cargo run -- remove --help
cargo-remove
Remove dependencies from a Cargo.toml manifest file
USAGE:
cargo remove [OPTIONS] <DEP_ID>...
ARGS:
<DEP_ID>... Dependencies to be removed
OPTIONS:
-p, --package [<SPEC>...] Package to remove from
-v, --verbose Use verbose output (-vv very verbose/build.rs output)
--manifest-path <PATH> Path to Cargo.toml
--offline Run without accessing the network
-q, --quiet Do not print cargo log messages
--dry-run Don't actually write the manifest
-Z <FLAG> Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
-h, --help Print help information
SECTION:
--dev Remove as development dependency
--build Remove as build dependency
--target <TARGET> Remove as dependency from the given target platform Example usage
How should we test and review this PR?This is following the pattern from cargo-add which was implemented in three different PRs (implementation, documentation, and completions), in the interest of reducing the focusing discussions in each PR and allowing cargo-add's behavior to settle to avoid documentation churn.
The remaining changes (documentation and shell completions) will follow shortly after. This is following some prep work done in Some work has already begun on this feature in rust-lang/cargo#11059. Work on this feature was carried out on the
In order to support this feature, the Tests are split out into a separate commit to make it easier to review the production code and tests. Tests have been implemented with Prior art
Insta-stabilizationIn the discussion of Since this feature is already has a had a long run of user testing in cargo-edit and doesn't have unsettled UI questions like cargo-add did, it might still be a candidate for insta-stabilization. Deferred workNecessary future work:
It was found in the review of Future PossibilitiesThe following are features which we might want to add to
Additional informationFixes #10520. |
I've posted a draft of the PR body above. There's still some stuff I want to add/polish, but I thought I'd post it sooner rather than later in case you have any feedback. |
Thanks for posting this! Some quick thoughts
|
Defer section
Docs deferral
|
I've updated the PR draft body above and started staging changes in a cargo fork (compare changes). I still have yet to do a final pass on both of these (I have to head out shortly), but they should be in a final-ish state. Let me know if you have any questions. Many thanks! :) |
I've made some tweaks directly to the draft. Good to go! |
Will need to backport changes from rust-lang/cargo#11194 when complete. |
No, we'll be deprecating We wanted to start dev in |
A scratchpad like #568
Ordered list:
cargo-add
--target
support (Add--target
flag to cargo-rm #711)CRATE
in help toDEP
to clarify that we want the dependency name and not the crate name (in case of a rename)merge-rm
branchcargo
sops/cargo_add/manifest.rs
into a place for reuseops/cargo_edit
oredit
and make it publiccargo-add
rust-lang/cargo#10577)The text was updated successfully, but these errors were encountered: