You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When uninjecting a package from another installed packages virtual environment the package is removed as expected but any apps that were exposed when creating the virtual environment into which you injected the package are also removed if a dependency provides the same app yet pipx list suggests they are still available. Noted this behaviour just after submitting #1364.
How to reproduce
Install a package e.g. pipx install python-lsp-server creating its isolated venv
pipx list shows:
package python-lsp-server 1.11.0, installed using Python 3.12.2
- pylsp
Inject a package into the venv created for the package installed in step 1
e.g. pipx inject python-lsp-server python-lsp-ruff
Uninject the package injected in step 3 with pipx uninject python-lsp-server python-lsp-ruff. I noticed too that some of the dependent packages of the injected package remain in the pipx venv when the injected package is uninjected. I would have expected all of its dependent packages to be removed with it but maybe this behaviour is expected as it is the same with pip if I'm not mistaken (just a beginner).
pipx list --include-injected shows the same as in step 2:
package python-lsp-server 1.11.0, installed using Python 3.12.2
- pylsp
Notice, pylsp is still listed as exposed but it is not.
which pylsp gives bash: type: pylsp: not found and ~/.local/bin shows:
and the venv directory also confirms it is no longer present:
All this suggests the behaviour of pipx uninject is more serious than raised in #1364.
Expected behavior
Pipx uninject should not touch apps exposed by the virtual environment into which you previously injected.
The text was updated successfully, but these errors were encountered:
To shed some more light on this behaviour. The python-lsp-server package exposes the pylsp app. The python-lsp-ruff package exposes no apps but its dependent packages python-lsp-server and ruff expose the pylsp and ruff apps respectively. So it seems if I uninject python-lsp-ruff from the python-lsp-server venv it removes the pylsp app because it thinks it is the pylsp app of its dependent package python-lsp-server despite not exposing it with the --include-deps option.
In such cases, I think it would be best if one could do something like the following:
$ pipx install python-lsp-server # exposing the pylsp app
$ pipx inject --include-deps=ruff python-lsp-server python-lsp-ruff # exposing the ruff app only
$ pipx uninject --include-deps=ruff python-lsp-server python-lsp-ruff # removing the ruff app only
Ideally, --include-deps could take a list of apps in case the injected package has more than one dependency with an app that we wish to expose and/or remove. Or except a regex to exclude a specific app.
I'm definitely in favour of selecting the dependency apps to include.
doolio
changed the title
pipx uninject removes apps made available when first creating the virtual environment
pipx uninject removes apps made available when first creating the virtual environment if a dependency provides the same app
Apr 26, 2024
Running pipx version1.4.3.
Describe the bug
When uninjecting a package from another installed packages virtual environment the package is removed as expected but any apps that were exposed when creating the virtual environment into which you injected the package are also removed if a dependency provides the same app yet
pipx list
suggests they are still available. Noted this behaviour just after submitting #1364.How to reproduce
pipx install python-lsp-server
creating its isolated venvpipx list
shows:Inject a package into the venv created for the package installed in step 1
e.g.
pipx inject python-lsp-server python-lsp-ruff
pipx list --include-injected
shows:Uninject the package injected in step 3 with
pipx uninject python-lsp-server python-lsp-ruff
. I noticed too that some of the dependent packages of the injected package remain in the pipx venv when the injected package is uninjected. I would have expected all of its dependent packages to be removed with it but maybe this behaviour is expected as it is the same withpip
if I'm not mistaken (just a beginner).pipx list --include-injected
shows the same as in step 2:Notice,
pylsp
is still listed as exposed but it is not.which pylsp
givesbash: type: pylsp: not found
and~/.local/bin
shows:and the
venv
directory also confirms it is no longer present:All this suggests the behaviour of
pipx uninject
is more serious than raised in #1364.Expected behavior
Pipx uninject should not touch apps exposed by the virtual environment into which you previously injected.
The text was updated successfully, but these errors were encountered: