Env variables do not get substituted in extras_require
See original GitHub issueEnvironment
- pip version: 20.2.2
- Python version: 3.8
- OS: any
Description
A PEP 508 URL with a ${ENVVAR}
placeholder like git+https://${GITHUB_TOKEN}@github.com/foo/bar.git
should have the placeholder replaced in every set of dependencies. It however seems to be only done in the installation requirements, not e.g. extra requirements.
Expected behavior PIP replaces the env var and says something like
Collecting testdep@ git+https://github.com/foo/bar.git
Cloning https://****@github.com/foo/bar.git to /private/var/folders/yn/_1p23xlj3ls77fstj2n2cbp80000gp/T/pip-install-cn6g7m6h/testdep
How to Reproduce
#!/bin/bash
set -e
rm -rf test-venv
python3 -m venv test-venv
source test-venv/bin/activate
pip install -U pip
cat >setup.py <<EOF
from setuptools import setup
setup(
name='test',
extras_require=dict(doc=[
'testdep@git+https://github.com/\${PROJ}.git',
]),
)
EOF
# example package without deps
export PROJ=flying-sheep/bcode
pip install .[doc] || true
deactivate
Output
Processing ~/test
Collecting testdep@ git+https://github.com/${PROJ}.git
Cloning https://github.com/${PROJ}.git to /private/var/folders/yn/_1p23xlj3ls77fstj2n2cbp80000gp/T/pip-install-dlnwrdhp/testdep
ERROR: Command errored out with exit status 128: git clone -q 'https://github.com/${PROJ}.git' /private/var/folders/yn/_1p23xlj3ls77fstj2n2cbp80000gp/T/pip-install-dlnwrdhp/testdep Check the logs for full command output.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Is there any way to substitute environment variables in ...
I don't want to hardcode the URL in my application.conf because it contains credentials that the developer should not have access to. playframework....
Read more >Substituting variable values | Cloud Build Documentation
Use substitutions in your build config file to substitute specific variables at build time. Substitutions are helpful for variables whose value isn't known ......
Read more >Using and Debugging Environment Variables - Software Verify
How to use environment variables to configure Validator tools, and how to debug them when the use of them doesn't work as expected....
Read more >Where variables can be used - GitLab Docs
As it's described in the CI/CD variables documentation, you can define many different variables. Some of them can be used for all GitLab...
Read more >Understanding Docker Build Args, Environment Variables and ...
Those values don't get injected into container environments. They are however available inside the docker-compose.yml file. They are used to substitute strings ...
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 Free
Top 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
Environment variables are supported in pip requirement files.
However that does not mean they are nor should be supported in
setup.py
. ~If that would be supported it would be the a feature of the build backend (setuptools in this case).~I am somewhat surprised it works in setup.py
install_requires
. If it does, could you try again withwheel
installed in the virtualenv (test-env/bin/pip install wheel
)?To support your use case you could use a requirements or constraints file. Write
extra_requires={'doc': ['testdep']}
in your setup.py then:huh. well, nevermind then, thank you for indulging me!