-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Can't override require-virtualenv
config option via CLI
#5528
Comments
I can confirm this is a regression:
|
Apparently using |
@justinmayer to your question -- just use |
https://github.com/pypa/pip/blob/master/src/pip/_internal/baseparser.py#L158 -- explicitly ignore empty values |
And just to finalize the saga -- when it is not empty, it uses "True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0. Raises ValueError if val is anything else." On invalid values, it will traceback:
|
No. I don't think setting pip clearly needs to print a better error message when the environment variable is not set correctly -- @moshez could you check if there's an existing issue for it otherwise file a new issue for this? |
Hi @pradyunsg, I opened #5616 -- I did some searching and did not see an existing issue. Will you manage the state of this ticket and #5616 ? I don't know if this one is supposed to be closed or something. |
Thanks! ^>^
Yeah; I'll keep this open to track a documentation change -- we should document how boolean options behave when used via environment variables. The other issue would serve to track changing to print a better error message when we get "blah" values. :P |
This issue is a good starting point for anyone who wants to help out with pip's development -- it's simple and the process of fixing this should be a good introduction to pip's development workflow. See the discussion above to understand what the desired fix is. Feel free to mention me (write @pradyunsg in the comment) if you need help with something. :) |
@pradyunsg |
This ticket is open @SummerGram. Would you like to work on this? |
@pradyunsg but I can't find |
Is this issue still relevant to the current codebase? |
@lakshmanaram Yes. Apologies for the delay in responding. I've been swamped by GitHub notifications since I was AWOL for a couple of weeks since the sprints. pip's configuration code automatically translates option for CLI into environment variables when checking. I'm a little short on time to find the exact links to lines of currently -- the relevant code is in |
@pradyunsg I would like to work on this issue. |
Looks like this got fixed at some point. From https://pip.pypa.io/en/stable/user_guide/#environment-variables:
@Divya063 Hi! Would you be willing to try solving a different issue? Perhaps #7804? |
Environment
Pip bundled along with Homebrew Python, subsequently upgraded to 10.0.1
Description
I always want
pip install
to require an activated virtual environment, unless I override that default on a per-invocation basis. In Pip 9.x it was possible to override therequire-virtualenv
default via thePIP_REQUIRE_VIRTUALENV
environment variable, but Pip 10 does not respect that environment variable nor seem to provide any way to overriderequire-virtualenv
on a per-invocation basis.Expected behavior
I expected Pip to respect the
PIP_REQUIRE_VIRTUALENV
environment variable and/or provide some other way to override therequire-virtualenv
setting.How to Reproduce
With a Pip configuration file including:
... override via environment variable and install the desired package to global site-packages:
Output
The above command behaved as expected up until Pip 10. When I attempt this on Pip 10, however, the
PIP_REQUIRE_VIRTUALENV
environment variable does not appear to be honored. Instead, an error is returned:Additional Notes
If there is a flag or some other way to override the
require-virtualenv
setting on a per-invocation basis, I cannot find it and would appreciate a pointer to its existence. Otherwise, I would prefer and humbly request that the ability to do so be restored in some manner or other.The text was updated successfully, but these errors were encountered: