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 · 3 comments
Open

Allow environment variables expansion in pyproject.toml #10096

ShaiAvr opened this issue Dec 22, 2024 · 3 comments
Labels
configuration Settings and such needs-decision Undecided if this should be done

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.

@woutervh
Copy link

woutervh commented Dec 23, 2024

I would reference a local symlink src/my-lib --> /absolute/path/to/my-lib

@ShaiAvr
Copy link
Author

ShaiAvr commented Dec 24, 2024

@woutervh I don’t think a symbolic link should be uploaded to git. The contents of the link won’t be portable.

@charliermarsh charliermarsh added the configuration Settings and such label Dec 26, 2024
@charliermarsh
Copy link
Member

Similar (but not identical) to #5734.

@charliermarsh charliermarsh added the needs-decision Undecided if this should be done label Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such needs-decision Undecided if this should be done
Projects
None yet
Development

No branches or pull requests

3 participants