Skip to content
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

Support for environment variables in requirement specifiers #6244

Closed
gioele opened this issue Feb 7, 2019 · 2 comments
Closed

Support for environment variables in requirement specifiers #6244

gioele opened this issue Feb 7, 2019 · 2 comments
Labels
auto-locked Outdated issues that have been locked by automation C: requirement file Using `requirements.txt`

Comments

@gioele
Copy link

gioele commented Feb 7, 2019

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 of pip install -r requirements.txt, but this would not work when pip is invoked by other tools like pipenv.

@xavfernandez
Copy link
Member

This should already be the case since pip 10 with #3728 ...

@cjerdonek cjerdonek added the C: requirement file Using `requirements.txt` label Feb 8, 2019
@gioele
Copy link
Author

gioele commented May 23, 2019

Indeed pip v10+ does support replacing env variables in requirements.txt files. Thanks for the info.

@gioele gioele closed this as completed May 23, 2019
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 22, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation C: requirement file Using `requirements.txt`
Projects
None yet
Development

No branches or pull requests

3 participants