Variable expansion doesnt work as "pipenv requirements"
See original GitHub issueIssue description
I am using private repo to install packages and it is refered in Pipfile.lock as like below
"sources": [
"url":"https://$USER:$ACCESS_TOKEN@gitlab.com/private/repo"
]
Here, pipenv requirements > requirements.txt
returns file using environment variables in unsupported format for pip install -r requirements.txt
Expected result(MODIFIED IN COMMENT)
# requirements.txt
-i https://expanded_username:expanded_token@gitlab.com/private/repo
random_lib == 0.0.0
...
pipenv lock --requirements > requirements.txt
returned expected result(this command no longer available)
Actual result
# requirements.txt
-i https://$USER:$ACCESS_TOKEN@gitlab.com/private/repo
random_lib == 0.0.0
...
Only POSIX format is supported for pip install -r
.
https://pip.pypa.io/en/stable/reference/requirements-file-format/#using-environment-variables
Issue Analytics
- State:
- Created a year ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
variable expansion doesnt work inside Pipfile in order to ...
Issue description I am trying to install a dependency from a private repo in order to this I have the following line data...
Read more >Advanced Usage of Pipenv - Read the Docs
Pipenv will expand environment variables (if defined) in your Pipfile. Quite useful if you need to authenticate to a private PyPI:.
Read more >VS Code doesn't use pipenv .env file - Stack Overflow
1 on ubuntu 16.04 with a Python 3.7.3 pipenv virtual environment, I am trying to set environment variables in a .env file, but...
Read more >pipenv Documentation - Read the Docs
Automatically install required Python version when pyenv is available. ... Pipenv will expand environment variables (if defined) in your Pipfile.
Read more >python-dotenv - PyPI
By default, load_dotenv doesn't override existing environment variables. ... Python-dotenv can interpolate variables using POSIX variable expansion.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround, couldn’t @RintaroMiyamoto specify the variables in the same way in the Pipfile?
"sources": [ "url":"https://${USER}:${ACCESS_TOKEN}@gitlab.com/private/repo" ]
The requirements file generated by the old command is definitely a bug, environment variables should not be expanded. But according to pipenv doc,
pipenv
supports for both$VARIABLE
and%VARIABLE%
, whilepip
doesn’t. That causes the issue. In order to work withpip
,${USER}
should be used instead of$USER
.