Skip to content

Equivalent of UV_PROJECT_ENVIRONMENT on uv.toml #12587

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

Open
carlosjourdan opened this issue Mar 31, 2025 · 4 comments
Open

Equivalent of UV_PROJECT_ENVIRONMENT on uv.toml #12587

carlosjourdan opened this issue Mar 31, 2025 · 4 comments
Labels
configuration Settings and such enhancement New feature or improvement to existing functionality

Comments

@carlosjourdan
Copy link

carlosjourdan commented Mar 31, 2025

Summary

Current Behavior

Afaik, the virtual environment path can only be configured via the UV_PROJECT_ENVIRONMENT environment variable.

Proposed Enhancement

Add support for configuring the virtual environment path in uv.toml and/or pyproject.toml configuration files.

Example configuration:

[tool.uv]
project-environment= "/path/to/venv"

Use Case & Motivation

  • Working in a Citrix/VDI environment where the users home dir is actually a network drive under the hood
  • Need to store virtualenvs on local disk for performance reasons
  • Supporting "citizen developers" who need a simple setup process:
    1. git clone
    2. uv sync
@carlosjourdan carlosjourdan added the enhancement New feature or improvement to existing functionality label Mar 31, 2025
@zanieb
Copy link
Member

zanieb commented Apr 1, 2025

I don't think we want to support this in the pyproject.toml, because then a project can cause a sync to an arbitrary location on your machine. This is a "user" setting, not a "project" setting — if that makes sense?

@zanieb zanieb added the configuration Settings and such label Apr 1, 2025
@zanieb
Copy link
Member

zanieb commented Apr 1, 2025

I think #1495 is a better fit for this use-case

@carlosjourdan
Copy link
Author

I get the distinction between "user" and "project" settings in typical development environments.

However, in VDI (and I suspect many other corporate environments), there are often strict controls on where users can write files. This makes the ability to sync to an aribtrary, pre-determined location a helpful feature rather than a problem.

#1495 would be a more elegant solution to this problem, but I hoped supporting the already existing environment variable through the toml configuration might be a simpler interim approach.

@elonzh
Copy link

elonzh commented Apr 23, 2025

Our Python environment depends on conda components, such as specific versions of OpenSSL, the compilation toolchain, etc. Therefore, we create environments using conda and handle this situation by specifying UV_PROJECT_ENVIRONMENT and UV_PYTHON. However, this is very inconvenient in daily development because these environment variables need to be set every time.

We have tried using pixi, but it is not suitable for us. Compared to uv, it lacks many features; for example, it does not support relative path dependencies, it can only build conda packages, and its dependency resolution prioritizes conda packages over PyPI packages.

Since we must work on the Windows platform, using tools like direnv to set environment variables is also not feasible.

We hope for a local, per-project implementation solution that only requires configuration once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
configuration Settings and such enhancement New feature or improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants