Skip to content
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

uv python find does not respect --project #11990

Open
zanieb opened this issue Mar 5, 2025 · 6 comments · May be fixed by #12049
Open

uv python find does not respect --project #11990

zanieb opened this issue Mar 5, 2025 · 6 comments · May be fixed by #12049
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@zanieb
Copy link
Member

zanieb commented Mar 5, 2025

Summary

❯ uv init example
❯ cd example
❯ uv sync
❯ uv python find
/Users/zb/workspace/uv/example/.venv/bin/python3
❯ cd ..
❯ uv python find
/Users/zb/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/bin/python3.13
❯ uv python find --project example
/Users/zb/.local/share/uv/python/cpython-3.13.0-macos-aarch64-none/bin/python3.13

This should discover the project environment

Platform

n/a

Version

0.6.4 (04db706 2025-03-03)

Python version

n/a

@zanieb zanieb added bug Something isn't working good first issue Good for newcomers labels Mar 5, 2025
@thejchap
Copy link
Contributor

thejchap commented Mar 6, 2025

@zanieb i'll take a look at this one

@zanieb
Copy link
Member Author

zanieb commented Mar 6, 2025

Cool! Let me know if you need help.

@thejchap
Copy link
Contributor

thejchap commented Mar 6, 2025

@zanieb looks like this affects the pip commands as well

> cd example
> uv pip show example
Name: example
Version: 0.1.0
...
> cd ..
> uv pip show example --project example
warning: Package(s) not found for: example

appears venvs are always discovered starting at the current directory

idea to fix for both uv pip and uv python is refactor find_python_installation/PythonInstallation::find to accept a "root" or "directory" argument and pass down to virtualenv_from_working_dir (probably with a rename and/or adding a new function that takes a path argument)

lmk if this is on the right track!

@zanieb
Copy link
Member Author

zanieb commented Mar 6, 2025

Oh interesting. I'm... not sure if I'd expect uv pip to respect --project when determining the path to virtual environments. I'll need to ponder that. Regardless, I think you're right that we need to thread through a directory to that function.

@zanieb
Copy link
Member Author

zanieb commented Mar 6, 2025

(as an aside, I wonder if accepting the root directory there will let us drop the current_dir testing hack we have)

thejchap added a commit to thejchap/uv that referenced this issue Mar 7, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 7, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 7, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 7, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 7, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 10, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 10, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 10, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
@thejchap thejchap linked a pull request Mar 10, 2025 that will close this issue
thejchap added a commit to thejchap/uv that referenced this issue Mar 10, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 11, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 12, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 13, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 13, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 13, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
thejchap added a commit to thejchap/uv that referenced this issue Mar 13, 2025
## Summary

this pr updates a couple discovery-related functions to accept a directory argument, used as the root directory when searching for a virtual environment

## Test Plan

todo
@thejchap
Copy link
Contributor

@zanieb i think #12049 is ready for a look - looked a little bit into removing the current_dir hack for testing - when removing this, a few tests fail even with passing the TestContext.workdir through. didn't dig too deep but wondering if it has something to do with PythonRequest::parse also depending on current_dir - decided to not mess with changing the api for that unless you think that's also worth doing as part of this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants