Skip to content

Provide a supported way to force uv to use only interpreters from a specific path #19027

@godlygeek

Description

@godlygeek

Summary

Our company has a set of managed Python interpreters. We don't want our employees to use other interpreters - including both the python-build-standalone ones and the ones that ship with the distro or OS.

With UV_PYTHON_DOWNLOADS='never' and UV_PYTHON_PREFERENCE='only-system' we can force uv (or a wrapper around uv that we provide, more likely) to never use the python-build-standalone interpreters and to only use interpreters that are already on the machine, but we don't have any reasonable way to prevent it from picking up interpreters in /usr/bin that come with the distro. We can't just remove /usr/bin from $PATH without breaking other things.

There's an environment variable, UV_TEST_PYTHON_PATH, that can be used to do exactly what we want - control the path to be used by uv for discovery of system interpreters without affecting the path used for other things. That exists because the uv test suite has the same need as we do, wanting to ignore some interpreters and only use ones found in a particular set of places.

Can that environment variable be documented as part of uv's official support surface?

Example

No response

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