-
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
Consider system packages as installed if the venv includes them #8359
Conversation
This changesets adds a getter to `env.virtual_env.VirtualEnv` to check whether it has access to system packages, and overrides the `is_path_relative_to_lib` method to take it into account. This will prevent Poetry from reinstalling system packages in the venv when they are already installed with a compatible version. Fixes: python-poetry#6035 Signed-off-by: Aurélien Bompard <[email protected]>
46b1fc8
to
baf4106
Compare
Signed-off-by: Aurélien Bompard <[email protected]>
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.
IMO, it would be nice to have a test in test_installed_repository.py
that checks that a package from system site packages does not have source_type == "directory"
.
Co-authored-by: Randy Döring <[email protected]>
I thought that as well, but in that file the virtual environment is entirely mocked, so I thought it wouldn't be terribly useful as I didn't change any of the calls in |
Signed-off-by: Aurélien Bompard <[email protected]>
I think it makes sense if we set up the test a little differently. Please take a look at the test I just added. |
Oh yeah that's a good idea! Thanks :-) |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This changeset adds a getter to
env.virtual_env.VirtualEnv
to check whether it has access to system packages, and overrides theis_path_relative_to_lib
method to take it into account.This will prevent Poetry from reinstalling system packages in the venv when they are already installed with a compatible version.
Resolves: #6035