-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support PyPy 3.8 #2206
Support PyPy 3.8 #2206
Conversation
def sources(cls, interpreter): | ||
for src in super(PyPy3Posix, cls).sources(interpreter): | ||
yield src | ||
host_lib = Path(interpreter.system_prefix) / "lib" | ||
if host_lib.exists() and host_lib.is_dir(): | ||
for path in host_lib.iterdir(): | ||
yield PathRefToDest(path, dest=cls.to_lib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fairly sure there was a pypy3 variant that worked like this (over a year ago when I wrote this). Doesn't this drop support for those?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's err on the side of caution and stick with @mgorny 's fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd actually prefer if we'd not do this 😊 but make it version-specific; if you can dig out from pypy when this change happened?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before PyPy's reorganization of the directory layout for python3.8 there were no directories in prefix/lib
.
It seems this code was added in #1503 in a blanket change to "support c-extensions inside virtual environments". The issue pointed to is #1448, but that issue only mentions include files, not lib files. It seems to relate to issue #1023, but that one is windows only and deals with the libs directory, not the lib one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, in that case I'm happy to go with your original proposal, sorry for the back and forth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, updating
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the pypy3 test suite fails 🤔
We should add a pypy3.7 run. |
Yes, we should have both 3.6 and 3.7 there 😊 |
b6a1c66
to
eccacfe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the CI passes 😊
Cool, thanks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the linux pypy3.8 tests will be fixed with rc2 which should be ready this week. I am not sure what is the problem with windows, is it missing python.exe ? |
Could be this tox-dev/filelock#101? Does pypy support https://docs.python.org/3/library/msvcrt.html#msvcrt.locking? Pypy on Windows is sometimes interesting 🤔 but don't have time to debug it... |
Maybe
Nominally, but there may be bugs since it is implemented via CFFI, so maybe there are threading problems ... |
Guess this is blocked until RC2 then? Ping me once that happens. |
ok, but I would like to leave windows out for now, otherwise we won't have a virtualenv story for the 3.8 release. |
Generally, we don't tend to do piecewise support 🤔 so if possible would prefer to fix Windows... 🤔 or at least mark the failing tests as skip explicitly 🤔 |
I need some help to debug the create_no_seed failures on windows. Although the source location has virtualenv/tests/unit/create/test_creator.py Line 216 in 9cd075e
But when I stop in a debugger where the exes are listed, virtualenv/src/virtualenv/create/via_global_ref/builtin/pypy/pypy3.py Lines 21 to 22 in 9cd075e
Why isn't it being copied? |
@mattip The tests failing are not the ones testing that our creator is correct, but rather than the built-in venv behaves equivalently to ours. And in this case seems pypy differs, as the python.exe is not created when using pypy builtin venv 🤔 the weird part here though is that neither 3.6 should pass... but for some reason does (only in the CI locally for me fails both). So guess the question is that should the venv module on Windows create python.exe? And if not we should patch the test to express such 😊 virtualenv does create this because people often expect python.exe to work even if one is in pypy... but seems venv from pypy does not. |
The 3.6 windows downloads were last updated for release 7.3.3, and have only |
Ahah. Found the problem with |
Is that within pypy venv module? |
Yes. |
cool. Fixing venv makes the failures go away locally. I will put that in for rc2 and then we can try it here in CI. |
👍 |
Something is off: |
It seems I should pay better attention to stdlib venv test failures. The problem is there, not with virtualenv |
virtualenv seems like a good place to test the venv module 😃 |
PyPy3.8 on windows hangs waiting for a lock in a virtualenv/src/virtualenv/util/lock.py Lines 92 to 95 in a40640c
refactored to
|
Is coverage running for PyPy? That makes the code run without the JIT which significantly slows things down. Would it be OK to toggle coverage off for PyPy? |
Additionally, macos PyPy 3.8 failed
A transient network error? |
The PyPy3 logic creates symlinks for all files from the library directory existing alongside the PyPy executable. This is meant to ensure that the bundled libraries to which PyPy is linked can also be found from inside the virtualenv. However, this logic also symlinks all directories which is unnecessary and causes library directory collisions with the new install layout. Change to logic to symlink non-directories only. A similar fix has been applied to the internal venv module in PyPy3.8: https://foss.heptapod.net/pypy/pypy/-/commit/713b2af9abd2b9453e12c60143e17431a1aefb33 Fixes pypa#2182
Signed-off-by: Bernát Gábor <[email protected]>
Rebased off main to get #2213. CI passed except codecov. |
PyPy has released a python3.8 that requires this change. |
I confirm that this PR fixes the problem for PyPy 3.8, released yesterday. |
Thanks for contributing, make sure you address all the checklists (for details on how see
development documentation)!
tox -e fix_lint
)docs/changelog
folderThis builds on and replaces #2204. In an earlier version of portable PyPy (one built on manylinux 2010 and bundling dependent shared objects), it was necessary to copy the bundled shared objects from
prefix/lib
. This is no longer needed since now thelibpypy3-c.so
is symlinked not copied.On non-portable PyPy installations, like those in distros or on conda-forge, this code was never used since there the dependent shared objects are provided outside the python tree.
Also fixed the stdlib which had python not pypy as the stem of the directory name.
I tested this locally to make sure it works as advertised.