Support for environment variables in requirement specifiers #6244
Labels
auto-locked
Outdated issues that have been locked by automation
C: requirement file
Using `requirements.txt`
Pip should accept bash-like enviroment variables in requirement specifiers and substitute them on the fly when pip is run.
What's the problem this feature will solve?
One possible use of this feature is installing packages from private GitHub repositories via OAuth. Right now this is not possible without storing the OAuth token in plain text in
requirements.txt
like, for example,git+https://1234abcdef56789:x-oauth-basic@github.com/myorg/private-package.git@v2.1
.Describe the solution you'd like
It would be nice if bash-like enviroment variables where accepted and substituted on the fly when pip is run. For example:
git+https://${GIT_TOKEN}:x-oauth-basic@github.com/myorg/private-package.git@v2.1
Alternative Solutions
A workaround is to use
pip install -r <(envsubst < requirements.txt)
instead ofpip install -r requirements.txt
, but this would not work when pip is invoked by other tools likepipenv
.The text was updated successfully, but these errors were encountered: