-
Notifications
You must be signed in to change notification settings - Fork 434
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
pipx install doesn't prompt for credentials for private vcs url #219
Comments
My guess is that this is because the pipx animation takes over the terminal and hides the prompt for the password. The animation runs until the subprocess command finishes. Does it just animate forever and never finish? The fix would be to not do the animation. Ways to do this:
|
Yes, it animates forever and never completes. As for a solution, a good compromise might be to disable animations when the It would of course be nice if pipx could detect when user prompts occur and drop out of the animation when they do, but that sounds like it would require considerable effort. btw, pipx is great, the Python ecosystem has needed this for years, too many people try to force pip and pypi into this role and it causes a lot of confusion. Keep up the great work. |
@uranusjr how does pipenv solve this? |
Had a quick check through the pipenv source and it looks like it's using this: https://github.com/sarugaku/vistir#spinner |
Thanks! What happens when installing from a protected source with pipenv? Does it spin indefinitely or does it stop spinning and drop back to the user/password prompt? If it drops back to the password prompt I'll take a look around the visitr source code to see how it does it. I don't want to add it as a dependency because it depends on quite a few things, and I would like to keep pipx as dependency-free as possible. |
I wonder if writing to a different stream might fix the issue too. Pipx writes the spinner to stderr. If pip writes to stderr, having pipx do the animation on stdout might fix it. https://github.com/pipxproject/pipx/blob/master/pipx/animate.py |
@cs01 Pipenv doesn’t have a solution either; it requires the credentials before installation (using environment variable injection). We have yet to find a good way to interact with pip. |
When I install from a private VCS using pipenv, it does actually prompt me for username and password, but the spinner still shows and keeps showing wherever the cursor is, leaving behind a trail of individual animation frames of the spinner, so it looks quite odd and isn't really an ideal solution. I think since usage of a private VCS isn't really going to be widespread, going with the simplistic approach of having a flag to disable animations and a section in the docs about using it with private VCS URLs might be the best "solution" for the moment. Unless you find that changing the animation stream works of course. |
I just ran into this recently during #302 , when I just deleted one character from my public github repo name, in order to try and force an error. Instead of getting an error that there was no package there, I got a github username prompt next to the animation spinner. It was confusing exactly what was going on. The only way to get out of this was Ctrl-C. It seems like at least maybe if we have no good way of the user entering username/password we should find a way to disallow it, or to exit early when we see it. |
We could try to use environment variables like pipenv, though @alexkillen's comment indicates pipenv doesn't have behavior any better than pipx, at least in some circumstances. Another thought is maybe |
For For regular HTTP(S) access pip doesn’t do it that well either, see pypa/pip#2920. |
It looks like pip's undocumented |
This is also an issue for private package feeds requiring credentials, eg an Azure artifacts feed It neither prompts, or works with artifacts-keyring like pip does |
I wasn't aware of artifacts-keyring. It looks like you need to install |
I'm running into a similar issue when trying to install from a private registry or In my case, I'm using In order to achieve something similar with |
@cs01 I'm not so sure... You'd still need to enter keyring's password somehow, don't you? Seems to me that pipx should add support for input, just as pip itself would do. It's not an easy solution though, I'm sure about it... |
If you're so sure I highly recommend drafting a PR, discussion can be more constructive if it is really that simple :) |
@uranusjr Oh God, I accidentally left out the word "not" 😂 |
Internet is so hard 😥 |
Perhaps the ‘GIT_ASKPASS‘ environment variable is what we’re looking for here. |
@cs01 Actually, in my case it's failing to authenticate against a private Nexus repository, no git is involved. |
#829 is a draft PR that adds something that sort of does that |
As a workaround, one can include the username:password or personal access token in the package in the package index URL, see PIP documentation: PIP_EXTRA_INDEX_URL=https://username:[email protected]/simple pipx install my-package |
Pip 23.1 allows you to configure it so it will use the keyring library even when --no-input is used. Now that that is possible I am of the opinion that Pipx should use --no-input unless --verbose is passed. Alternatively passing -qqqqq and --log to Pip and a more complicated animation implementation might also be a direction that can be explored. I am working on a PR for --no-input strategy. The test are giving me some trouble on Python < 3.11, so feel free to nerd-snipe me! |
Describe the bug
Regular
pipx install
command doesn't work for private vcs urls that require authentication. Runningpipx install --spec git+https://<some_private_repo>.git <package_name>
does not prompt the user for username and password. If the--verbose
option is provided, it works fine.How to reproduce
Run above command using a private vcs url (e.g. github, gitlab, bitbucket) and do not use
--verbose
.Expected behavior
Should prompt user for credentials, even when
--verbose
is not used.Environment
The text was updated successfully, but these errors were encountered: