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
python: extend python test with site-packages import #88787
Conversation
To aid in finding a solution for the issues where python.withPackage is expected to be able to import from site-packages inside venv or virtualenv
@@ -46,6 +46,12 @@ def test_base_prefix(self): | |||
def test_python_version(self): | |||
self.assertTrue(platform.python_version().startswith(PYTHON_VERSION)) | |||
|
|||
@unittest.skipIf(IS_NIXENV and IS_VENV, "TODO: Import from site-package does not work in nixenv-venv.") |
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.
Todo or not supported? I'd say we should not support this, but at the same time, I know those that really like such feature.
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.
Hm, there are quite a few issues open with that, but then again i don't really know the exact use cases. For me it all started with that i wanted to build rust servo
, this needs mach
and this needs psutil
and then i was in the situation that when having a nix-shell --pure
with python.withPackages
and psutil
, the mach
build would not use the psutil
from python.withPackages
but trying to build a fresh one which does not succeed since gcc
is not present because it's a pure shell and for servo
to build it went with clang
.
I don't even know if that counts as use case, because i don't even understand if the mach
system is trying to use venv
or virtualenv
features, and i cannot understand why it is not using the prebuild psutil
and thought it might be related.
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.
Said that, feel free to change it to your liking :)
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.
And on another thought, it just feels wrong if venv
or virtualenv
is present and usable in python.withPackages
but one can not access the site-packages.
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.
At least virtualenv
does have the option --system-site-packages
from which i would expect that this is indeed possible.
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 running the tests against staging right now, and have a PR waiting against staging. I changed the wording in skipIf to be "Unsupported: ..."
I marked this as stale due to inactivity. → More info |
Motivation for this change
To aid in finding a solution for the issues where python.withPackage
is expected to be able to import from site-packages inside venv or virtualenv
Things done