-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
poetry use pypy3
switches to a Python 3.6 venv if it already exists
#2089
Comments
Hello @thedrow, poetry creates the venv folders based on the project's name, its path and the python version. Maybe we should take the name (or the path) of the executable into account when creating the venv? fin swimmer |
Just include the platform if it's not CPython in the virtualenv's name. |
Good idea 👍 But I guess this won't be fixed soon, as this would be a breaking change. |
I'd rather you'd make it a higher priority since it interferes with my workflow when using nox. So you can either make #1579 a higher priority or this issue. I'd argue it's not much of a breaking change anyway. At most, a new virtualenv will be created for the user which isn't that bad. |
I gave it a quick shot with diff --git a/poetry/utils/env.py b/poetry/utils/env.py
index dcdec03..f0aa631 100644
--- a/poetry/utils/env.py
+++ b/poetry/utils/env.py
@@ -589,7 +589,13 @@ class EnvManager(object):
venv = venv_path
else:
name = self.generate_env_name(name, str(cwd))
- name = "{}-py{}".format(name, python_minor.strip())
+ if platform.python_implementation() != "CPytohn":
+ implementation = platform.python_implementation().lower()
+ if implementation == 'pypy':
+ implementation = '{}{}'.format(implementation, sys.pypy_version_info)
+ name = "{}-py{}-{}".format(name, python_minor.strip(), implementation)
+ else:
+ name = "{}-py{}".format(name, python_minor.strip())
venv = venv_path / name
if not venv.exists(): And unfortunately I get an unrelated error:
Maybe I don't know how to correctly setup the dev env for poetry. |
Would be nice to have a fix for this issue in 1.1. |
I gave it ≈30 mins in the above PR but was not able to get all the way. Too bad, since I'd like having pypy support available for experimentation. |
With some more time that PR now seems to work, at least with my installation of pypy. |
-vvv
option).Issue
When I try to switch my environment to PyPy3 using
poetry use pypy3
but have previously typedpoetry use 3.6
poetry switches to the CPython 3.6 virtualenv instead of creating a new virtualenv for pypy3.You can reproduce this by doing the following:
The text was updated successfully, but these errors were encountered: