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

[FR] Environment variables substitution for dynamic dependencies #4765

Open
1 task done
sondalex opened this issue Dec 10, 2024 · 0 comments
Open
1 task done

[FR] Environment variables substitution for dynamic dependencies #4765

sondalex opened this issue Dec 10, 2024 · 0 comments
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.

Comments

@sondalex
Copy link

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:

  1. Define a private dependency in requirements.txt:

    mypackage@https://${PAT}@<pypi-feed>/<path>
    
  2. Specify dynamic dependencies in pyproject.toml:

    [project]
    # Other project metadata
    dynamic = ["dependencies"]
    
    [tool.setuptools.dynamic]
    dependencies = { file = ["requirements.txt"] }
  3. Set the necessary environment variables before installation:

    export PAT=...
    export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring # To avoid interactive prompts
  4. 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
@sondalex sondalex added enhancement Needs Triage Issues that need to be evaluated for severity and status. labels Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

1 participant