-
Notifications
You must be signed in to change notification settings - Fork 432
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
inject, install accept package spec without --spec option #302
Conversation
@cs01 feel free to modify code if it seems fun to you. Otherwise I'm happy to do the normal review process... |
Note, I may be out of communication for the next few days, but I may check in occasionally. |
Oh and before I forget, I was also thinking about making the |
The _python name change is fine with me. |
For compatibility in the extremely unlikely event that anyone else is using it (was it in any previous releases?), |
AFAIK it was just an internal variable inside of Venv (hence the underscore). I assume that the Venv author just assumed it would never be used outside. I'm guessing that nobody was using it, and they were already "warned" when it had the starting underscore that they shouldn't. 😄 |
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.
Looks great, just a couple comments
- add animation (see inline comment)
- update
docs/examples.md
- update the changelog
- would be nice to update the text in the install animation. This has been existing pipx behavior but I just noticed it. Right now it says "Installing package ", and it displays the spec. It would be better if it said, for example,
installing package 'black' from pip specification 'https://github.com/ambv/black/archive/18.9b0.zip'
so it is always very clear what the package determination was from the pip specification. If this is not added in this PR, that is fine. We can create an issue and do it later.
Regarding the animation:
|
I made install_package error out if package name cannot be determined. I think this should be the wisest thing to do. |
I revamped the package errors. I subclassed Currently if |
I removed the specific |
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.
Great work, thank you! I will let you merge.
This PR allows the user to specify any valid pip package specification instead of a package name for the main argument to
pip install
and each dependency argument topip inject
. It removes the--spec
option forpip install
because now that option is unnecessary. And it enables a package spec forpip inject
which formerly wasn't possible.It takes about 2 extra seconds on my local computer to determine the package name from package spec. If
package_spec
is a valid pypi name and not a local path, I make a shortcut and assume that it is the package name and don't try to independently determine the name (in which case it takes no extra time).I tried to add some tests, but there could be more tests added, specifically regarding the many different VCS and other URL methods to specify pip packages. One issue with that is that
git+...
package specifications needgit
in the path, which I wasn't sure how to do. (#298 (comment) seems like a good way forward on this.) Additionally, I just wasn't sure where to find good package urls to use to test.This PR is in reference to issue #147