[FR] Environment variables substitution for dynamic dependencies
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
What's the problem this feature will solve?
Setuptools supports dynamically specifying dependencies through pyproject.toml using the following syntax:
[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }
The requirements.txt format, as described in the pip documentation, includes a proposal for environment variable substitution. However, this functionality is not currently implemented in setuptools.
Describe the solution you'd like
Introduce support in setuptools for substituting environment variables when parsing dependencies from a requirements.txt file. This would enable use cases like the following:
-
Define a private dependency in
requirements.txt:mypackage@https://${PAT}@<pypi-feed>/<path> -
Specify dynamic dependencies in
pyproject.toml:[project] # Other project metadata dynamic = ["dependencies"] [tool.setuptools.dynamic] dependencies = { file = ["requirements.txt"] } -
Set the necessary environment variables before installation:
export PAT=... export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring # To avoid interactive prompts -
Run the installation:
pip install .
This feature would be especially beneficial for non-interactive sessions, such as CI/CD pipelines.
Alternative Solutions
No response
Additional context
No response
Code of Conduct
- I agree to follow the PSF Code of Conduct
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how setuptools reads [tool.setuptools.dynamic] dependencies from requirements.txt during pip install .. Check the pip requirements-file environment-variable syntax described in the issue and verify the PAT-based example works in a non-interactive installation; done means variables are substituted when parsing dynamic dependencies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100