Skip to content

uninject --leave-deps can break dependencies for remaining packages #1672

@Vrihub

Description

@Vrihub

Describe the bug

When uninjecting a package, pipx by default also uninstalls the dependencies of the uninjected package, unless the --leave-deps option is used.

This can break dependencies for remaining packages in the venv, which could have dependencies in common with the uninjected package.

I experienced this on a venv in which a package with some "extras" was installed, as in pipx install package[extra1,extra2]. When uninjecting the packages needed for extra2, some dependencies in common with extra1 were uninstalled too, breaking its functionality.

Expected behavior

First best would be to have uninject to check if any dependency planned to be uninstalled is also a dependency for other packages in the venv, and don't uninstall it if that's the case.

If that is not possible, I think that --leave-deps should be the default behaviour with uninject, and there should be a --uninstall-deps (or --include-deps?) option to force the current default behaviour (after warning the user about potentially dangerous effects).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions