Consider system packages as installed if the venv includes them#8359
Consider system packages as installed if the venv includes them#8359radoering merged 6 commits intopython-poetry:masterfrom
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]>
radoering
left a comment
There was a problem hiding this comment.
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 :-) |
References: - https://github.com/python/cpython/blob/042aa88bcc6541cb8b312f1119452f7a58a5b4df/Lib/site.py#L515-L522 - https://peps.python.org/pep-0405/#specification Signed-off-by: Aurélien Bompard <[email protected]>
|
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.VirtualEnvto check whether it has access to system packages, and overrides theis_path_relative_to_libmethod 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