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 venv doesn't add PyPy executables #2092

Closed
charliermarsh opened this issue Feb 29, 2024 · 9 comments · Fixed by #5047
Closed

uv venv doesn't add PyPy executables #2092

charliermarsh opened this issue Feb 29, 2024 · 9 comments · Fixed by #5047
Labels
pypy Related to PyPy support

Comments

@charliermarsh
Copy link
Member

We don't officially support PyPy right now, this is more a note for the future, but we need to include a variety of pypy binaries / symlinks:

❯ ls .venv/bin
Activate.ps1  activate      activate.csh  activate.fish pip           pip3          pip3.9        pypy          pypy3         pypy3.9       python        python3       python3.9
@charliermarsh charliermarsh added the pypy Related to PyPy support label Feb 29, 2024
@charliermarsh
Copy link
Member Author

@gaborbernat - A related question: how does virtualenv "know" to create site-packages for PyPy at .venv/lib/pypy3.10/site-packages instead of .venv/lib/python3.10/site-packages? Is that encoded in virtualenv somewhere? Or is it read from the interpreter? Was trying to find it.

@gaborbernat
Copy link
Contributor

That's done here https://github.com/pypa/virtualenv/blob/main/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py#L31 and https://github.com/pypa/virtualenv/blob/main/src/virtualenv/create/via_global_ref/builtin/pypy/common.py#L41. It knows to do that just for PyPy because of https://github.com/pypa/virtualenv/blob/main/src/virtualenv/create/via_global_ref/builtin/pypy/common.py#L13. The purelib/platlib paths are using the sysconfig information, which is inquired as part of https://github.com/pypa/virtualenv/blob/main/src/virtualenv/discovery/py_info.py#L80-L103.

Note that .venv/lib/pypy3.10/site-packages is often refered to as purelib, and in CPython by default this aligns up with platlib, but CPython allows distributions to move this to their desired path. So ultimately, the question is: When you say .venv/lib/pypy3.10/site-packages are you refering to platlib or purelib?

@charliermarsh
Copy link
Member Author

Ah yeah, I'm referring to purelib. (Though I haven't really done the work yet to understand what happens when you, e.g., pip uninstall and purelib and platlib are not the same thing.)

If sysconfig is returning the purelib and platlib paths for the invoked interpreter, where / how do those get translated to paths for the virtualenv? E.g.:

>>> sysconfig.get_paths(scheme="venv")
{'stdlib': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0/lib/python3.12', 'platstdlib': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0/lib/python3.12', 'purelib': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0/lib/python3.12/site-packages', 'platlib': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0/lib/python3.12/site-packages', 'include': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0/include/python3.12', 'platinclude': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0/include/python3.12', 'scripts': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0/bin', 'data': '/Users/crmarsh/.local/share/rtx/installs/python/3.12.0'}

@gaborbernat
Copy link
Contributor

That depends. You can get the schema and inject your config vars of sys.prefix to calculate where it should go.

@gaborbernat
Copy link
Contributor

@charliermarsh
Copy link
Member Author

Thank you!

@charliermarsh
Copy link
Member Author

Filed some info in #2095. (No obligation to chime in there.)

@charliermarsh
Copy link
Member Author

@edgarrmondragon - when you’re in a PyPy virtualenv, do you typically invoke Python as “pypy” or “python”? I’m trying to make some decisions around this with respect to #2316.

@edgarrmondragon
Copy link
Contributor

@edgarrmondragon - when you’re in a PyPy virtualenv, do you typically invoke Python as “pypy” or “python”? I’m trying to make some decisions around this with respect to #2316.

Actually, always as python or python3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pypy Related to PyPy support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants