pip
pip copied to clipboard
Confirm before installing requirements globally
What's the problem this feature will solve?
This will save you from mistakenly installing your project's requirements globally
Describe the solution you'd like
Check if virtualenv is activated. If not then ask for confirmation
Installing requirements
$ pip install -r requirements.txt
Installing globally, Proceed (Y/n)? # If virtualenv not activated
to skip check
$ pip install -r -y requirements.txt
Alternative Solutions
It has to be added to pip itself.
Additional context
https://pip.pypa.io/en/stable/cli/pip_uninstall/#cmdoption-y
Code of Conduct
- [X] I agree to follow the PSF Code of Conduct.
You can use the --require-virtualenv
option (which you can set via an environment variable or in your config file) to get a very similar effect.
It is very good. Wouldn't it be better if it was the default behaviour?
I think no body would want to install requirements globally
And if you want force install globally, you could use a -f
flag
$ pip install -f -r requirements.txt
I think all pip maintainers want to make it the default behaviour, except a lot of people out there are going to be very angry about it.
See https://github.com/pypa/pip/issues/10833 where this was discussed extensively, with the conclusion being to use a different mechanism that'll propagate more slowly to minimise churn costs for us.