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

python: extend python test with site-packages import #88787

Closed
wants to merge 1 commit into from

Conversation

calbrecht
Copy link
Member

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

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
@calbrecht calbrecht requested a review from FRidh as a code owner May 24, 2020 16:01
@@ -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.")
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member Author

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 :)

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member Author

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: ..."

@stale
Copy link

stale bot commented Jun 6, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 6, 2021
@calbrecht calbrecht closed this Aug 2, 2022
@calbrecht calbrecht deleted the extend-python-test branch January 4, 2024 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants