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

Allow environment variables expansion in pyproject.toml #10096

Open
ShaiAvr opened this issue Dec 22, 2024 · 0 comments
Open

Allow environment variables expansion in pyproject.toml #10096

ShaiAvr opened this issue Dec 22, 2024 · 0 comments

Comments

@ShaiAvr
Copy link

ShaiAvr commented Dec 22, 2024

A feature I'd really like to see implemented is the ability to expand environment variables in the pyproject.toml file. My use-case is as follows: I am working on a library to simplify my work on other projects. In the future, I'd like to publish the library to PyPi. When I work on my projects, however, I want to use my library as a local editable dependency so I can quickly make changes and see them applied. So I have an example project with the following pyproject.toml:

[project]
name = "demo"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "my-lib",
]

[tool.uv.sources]
my-lib = { path = "/path/to/my/library/my-lib", editable = true }

The problem is I am using an absolute path for my library, so I need to modify it if I work on multiple computers, and it's not something I'd want to push to GitHub. A better solution would be to have an environment variable that defines the location of the library on my local machine: MY_LIB_PATH="/path/to/my/library/my-lib". That way, I can define the environment variable as necessary on different machines and my pyproject.toml file will simply use this variable:

[project]
name = "demo"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "my-lib",
]

[tool.uv.sources]
my-lib = { path = "${MY_LIB_PATH}", editable = true }

This isn't possible at the moment, and I think expanding environment variables in the pyproject.toml file could solve my use case and other similar use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant