Skip to content

Expose UV_PYTHON_SEARCH_PATH for Python discovery PATH overrides#19034

Merged
zanieb merged 5 commits intoastral-sh:mainfrom
zaniebot:claude/replace-python-path-env-D9bZG
Apr 20, 2026
Merged

Expose UV_PYTHON_SEARCH_PATH for Python discovery PATH overrides#19034
zanieb merged 5 commits intoastral-sh:mainfrom
zaniebot:claude/replace-python-path-env-D9bZG

Conversation

@zanieb
Copy link
Copy Markdown
Member

@zanieb zanieb commented Apr 17, 2026

Closes #19027
Closes #9506 (while the request there is to extend PATH, they can set UV_PYTHON_SEARCH_PATH=...;$PATH)

@zanieb zanieb added the configuration Settings and such label Apr 17, 2026
@zanieb zanieb changed the title Rename UV_TEST_PYTHON_PATH to UV_PYTHON_SEARCH_PATH Expose UV_PYTHON_SEARCH_PATH for Python discovery PATH overrides Apr 17, 2026
Copy link
Copy Markdown
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "breaking"?

Comment thread crates/uv-static/src/env_vars.rs Outdated
@zanieb
Copy link
Copy Markdown
Member Author

zanieb commented Apr 17, 2026

I don't think UV_TEST_* is a part of the public API — it's hidden.

@godlygeek
Copy link
Copy Markdown

https://github.com/search?q=UV_TEST_PYTHON_PATH+-language%3ARust&type=code shows that nothing on github other than clones of uv itself seems to be relying on UV_TEST_PYTHON_PATH.

claude and others added 3 commits April 17, 2026 13:04
Promote the internal test-only `UV_TEST_PYTHON_PATH` environment variable
to a user-facing `UV_PYTHON_SEARCH_PATH` that overrides `PATH` for Python
executable discovery. Add dedicated integration test coverage in
`python_find_search_path`.

https://claude.ai/code/session_01XUesSCJ1o1nHBxFEBEzfZ3
@zanieb zanieb force-pushed the claude/replace-python-path-env-D9bZG branch 2 times, most recently from 77ed576 to 21e63b0 Compare April 17, 2026 18:23
@zanieb zanieb marked this pull request as ready for review April 17, 2026 19:34
Comment thread crates/uv/tests/it/python_install.rs Outdated

// List installed versions with registry discovery enabled.
// We remove UV_TEST_PYTHON_PATH to enable registry discovery (it's skipped when set),
// We remove `UV_PYTHON_SEARCH_PATH` to enable registry discovery (it's skipped when set),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed this during review — I don't think we want this behavior so #19035 is needed.

zanieb added a commit that referenced this pull request Apr 20, 2026
Required for #19034

Arguably, we could keep our existing behavior and have
`UV_PYTHON_SEARCH_PATH` implicitly disable the registry lookup, but I
think that's too confusing.

This disables registry lookups everywhere and modifications in `uv
python install`. In the latter case, `UV_PYTHON_INSTALL_REGISTRY` takes
precedence.
@zanieb zanieb enabled auto-merge (squash) April 20, 2026 19:03
@zanieb zanieb merged commit 7cd3c23 into astral-sh:main Apr 20, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration Settings and such

Projects

None yet

4 participants