-
Notifications
You must be signed in to change notification settings - Fork 180
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
Add --pypi
option to pixi remove
#602
Add --pypi
option to pixi remove
#602
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @marcelotrevisani
Thanks for your work!
There are some things I would change. Let me know if my reviews need more explaining!
Thanks for reviewing this, I will do the modifications later today :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvements! few more notes, would like to get some more scenarios tested to avoid missing some features or breaking them in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One final comment, but otherwise look good to me!
src/cli/remove.rs
Outdated
.remove_target_dependency(dep, &spec_type, p) | ||
if args.pypi { | ||
let pkg_name = rip::types::PackageName::from_str(dep.as_source()) | ||
.expect("Expected dependency name."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just like with the add
functionality I think this cli subcommand should accept strings for deps
. Parsing into a package name should yield an error if its not a valid package name. That way the user gets the best possible error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored that, please take a look again :)
f5f6caf
to
a8a1593
Compare
@marcelotrevisani As mentioned in discord, we would like to refactor the flow of the We would like it to first do all the input validation and then iterate over those results to remove them from the project. This would then also reintroduce the early out but with an actual error. Do you want to do this refactor or can I push to your branch? |
I can try to do it later on |
…section in pixi.toml
fbd7697
to
19fd138
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is much beter! Thanks for the refactor.
One more case that needs dealing with.
src/cli/remove.rs
Outdated
} else { | ||
project.manifest.remove_pypi_dependency(dep)? | ||
}; | ||
print_ok_dep_removal( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printing in this function will possibly give incorrect information to the user as you might error in a next iteration.
e.g.
pixi rm --pypi requests bla
# Results in:
Removed requests "*" from [pypi-dependencies]
× Couldn't find bla in pypi-dependencies
But as the save only happens later it will not actually be removed from the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, I will change that later today, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @marcelotrevisani
Remove dependencies on pypi-dependencies section in pixi.toml
It fixes #591