Skip to content

Manage all uv-related directories #11360

Description

@Ma-Shell

Summary

Note: This issue is somewhat related to #6067, especially this comment, mentioning that the UV_PYTHON_INSTALL_DIR option might be exposed to uv.toml, as well as #6506 but extends it to further directories, adds some further reasoning and has a generally wider scope, so I opted for creating a new issue.

UV uses multiple directories. The documentation refers to these 5 but there might be more which I missed.

Directory command environment variable uv.toml/pyproject.toml
cache uv cache dir UV_CACHE_DIR cache-dir
python uv python dir UV_PYTHON_INSTALL_DIR -
python bin uv python dir --bin UV_PYTHON_BIN_DIR -
tools uv tool dir UV_TOOL_DIR -
tools bin uv tool dir --bin UV_TOOL_BIN_DIR -

There are several improvements for managing these:

  • Add a command which lists all of them for more transparency with the user
  • For the ones, where there is no .toml-entry available, one should be added. This would help especially when using a global uv.toml, to allow to define one base-directory for everything, without relying on environment variables.
  • While the documentation mentions that there is a platform-dependent location for a default uv.toml, it would be beneficial to have uv also check the uv-executable's directory for a uv.toml, which again would help with having everything uv-related in one directory.

Example

The proposed features allow having a portable installation giving the user more control about what paths are touched by UV.

Being able to manage the directories in the toml-file without relying on environment variables also helps for having globally installed projects in multi-user environments as the default-locations refer to directories within the user's profile (like %APPDATA% or ~/.local) which are not readable by all users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement to existing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions