Add support for --prefix and --with installations in find_uv_bin#14184
Merged
Add support for --prefix and --with installations in find_uv_bin#14184
--prefix and --with installations in find_uv_bin#14184Conversation
Flamefire
reviewed
Jun 21, 2025
This was referenced Jun 30, 2025
konstin
reviewed
Jun 30, 2025
| # The scripts directory for the base prefix | ||
| sysconfig.get_path("scripts", vars={"base": sys.base_prefix}), | ||
| # The user scheme scripts directory, e.g., `~/.local/bin` | ||
| sysconfig.get_path("scripts", scheme=_user_scheme()), |
Member
There was a problem hiding this comment.
Should we do this last? This could easily pick up a different, global uv installation.
Member
There was a problem hiding this comment.
This actually happens for me:
$ uv pip install --prefix foo_prefix --find-links target/wheels/ --no-index uv
$ PYTHONPATH="foo_prefix/lib/python3.12/site-packages/" python -S -c "import sys; print(sys.path); from uv import find_uv_bin; print(find_uv_bin())"
['', '/home/konsti/projects/uv/bar', '/usr/lib/python312.zip', '/usr/lib/python3.12', '/usr/lib/python3.12/lib-dynload']
/home/konsti/.local/bin/uv
Member
Author
There was a problem hiding this comment.
Yeah that's what we're discussing at #14184 (comment)
Member
Author
There was a problem hiding this comment.
I consider this a distinct change, will be addressed by #14191
zanieb
added a commit
that referenced
this pull request
Aug 7, 2025
Adds test cases to unblock - #14181 - #14182 - #14184 - #14184 - tox-dev/pre-commit-uv#70 We use a package with a symlink to the Python module to get a mock installation of uv without building (or packaging) the uv binary. This lets us test real patterns like `uv pip install --prefix` without encoding logic about where things are placed during those installs. --------- Co-authored-by: konstin <konstin@mailbox.org>
2bd9a39 to
ee983d3
Compare
--prefix installations in find_uv_bin--prefix and --with installations in find_uv_bin
Member
Author
|
It depends on what you mean by overly permissive. #14191 just changes the ordering so we don't search in the user script directory before checking everywhere else that could be associated with the actual module. |
henryiii
reviewed
Aug 8, 2025
| if not all( | ||
| fnmatch(part, match_part) | ||
| for part, match_part in zip( | ||
| reversed(parts), reversed(match_parts), strict=False |
Contributor
There was a problem hiding this comment.
This doesn't support Python 3.8 and 3.9. strict= was introduced in 3.10.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows #14182
Adds support for the case described at #10194 (comment)
This also happens to fix both
--withrequirement test cases, which should close tox-dev/pre-commit-uv#70