Conversation
|
Hi! Does |
| } | ||
| // Check if the value is current active pyenv virtualenv | ||
| // It mean that name is end of path provided by PYENV_VIRTUAL_ENV variable | ||
| if let Some(pyenv_virtual_env) = std::env::var_os("PYENV_VIRTUAL_ENV") { |
There was a problem hiding this comment.
pyenv sets both PYENV_VIRTUAL_ENV and VIRTUAL_ENV to the same value. Maybe should here VIRTUAL_ENV?
There was a problem hiding this comment.
We already read VIRTUAL_ENV — is it not working for you?
|
I'm not sure if we'll accept this functionality yet, but I think you'd want to add it at uv/crates/uv-python/src/discovery.rs Lines 225 to 242 in bf3286c |
Yes. It set. I put a comment in meantime.
Based on my tries, this code is not reached if the |
|
I see. The |
No. This is default location where pyenv store which python use: https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-local Seting python version using pyenv cli will be put in this file. |
|
In the same way we let you put versions in that file, but not the name of an environment. It sounds like you put an environment name in there which will break uv as we'll try to find it as an executable name. |
If I put only Python versions in this file, it will lead to work in a global Python installation, not isolated per context. As far as I know, the Because of this, it is recommended to not store And |
|
I don't see using an environment name in the version file in the pyenv documentation. Regardless, I don't think it's a use-case we can support. |
|
Using of named virtualenv is described in documentation of
|
|
I see, thanks. It sounds like this is an extension of |
|
I'm pyenv user, not a maintainer. I think that this part of pyenv documentation is valid part of specyfication:
So |
This is correct and somewhat the historical use of To illustrate, say you have >$ mkdir myproject
>$ cd myproject
myproject>$ echo 'testenv3.12' > .python-version
myproject>$ pyenv virtualenv 3.12.7 testenv3.12
(testenv3.12) myproject>$ python -c 'import sys; print(sys.prefix)'
/home/dev/.pyenv/versions/testenv3.12
(testenv3.12) myproject>$ echo '3.12.7' > .python-version
myproject>$ python --version
Python 3.12.7
myproject>$ python -c 'import sys; print(sys.prefix)'
/home/dev/.pyenv/versions/3.12.7
myproject>$ echo '3.13.0rc3' > .python-version
myproject>$ python --version
Python 3.13.0rc3
myproject>$ python -c 'import sys; print(sys.prefix)'
/home/dev/.pyenv/versions/3.13.0rc3
myproject>$ pyenv virtualenv 3.13.0rc3 testenv3.13
myproject>$ echo 'testenv3.13' > .python-version
(testenv3.13) myproject>$ python -c 'import sys; print(sys.prefix)'
/home/dev/.pyenv/versions/testenv3.13
(testenv3.13) myproject>$ cd ..
>$ |
|
I do not understand why tests fail. Could you hint me? |
|
The test is failing because you changed version file parsing to split on within-line whitespace so something such I'll repeat that I'm pretty unsure that we'll accept this change though. |
|
Hm. |
|
What should I update/motivate here? |
|
I'm still not excited about making this change. It relies on some specific third-party behavior and we generally try not to integrate with third-party Python discovery mechanisms here. |
Maybe some other change, to make uv not crash if someone is using When I now call |
|
I believe #12909 should cover the use-case you have here, without encoding knowledge of |
Summary
I'm using pyenv with pyenv-virtualenv for my daily workflow.
Currently,
uv pipnice works as a replacement of pip, however, try to useuvxoruv buildit ends with error messageWhere
partsegcoreis the name of virtualenv.This PR is fixing this
Test Plan
I tested it locally.