pdm icon indicating copy to clipboard operation
pdm copied to clipboard

Add option to `pdm remove` to only remove specified packages(s)

Open DUOLabs333 opened this issue 2 years ago • 6 comments

Is your feature request related to a problem? Please describe.

I want to reinstall a package though a manually built wheel, so I want to uninstall the package and reinstall it with pdm add ./<name of wheel>. However pdm remove <package> uninstalls not only the package, but every other package that now becomes an orphan.

Describe the solution you'd like

Maybe an option for pdm remove --only <package> that only uninstalls that package, not anything else?

DUOLabs333 avatar Mar 13 '22 20:03 DUOLabs333

Do you agree that the environment should be kept in sync with the lock file and the lock file should be kept in sync with the pyproject.toml dependencies? Then what do you think of this feature request?

frostming avatar Mar 14 '22 01:03 frostming

Usually, yes -- that's why I asked for a switch as a special case. pdm sync should then sync it properly.

DUOLabs333 avatar Mar 14 '22 01:03 DUOLabs333

Maybe it's possible to instead have an option to force sync one package only?

DUOLabs333 avatar Mar 17 '22 15:03 DUOLabs333

I got around this with pdm add -e ./<package>, which is ideal for my needs, but there are some scenarios where I want to reinstall a wheel.

DUOLabs333 avatar Mar 17 '22 15:03 DUOLabs333

Maybe you could just remove the pypackages of that module?

DUOLabs333 avatar Mar 18 '22 11:03 DUOLabs333

Every requested feature might be useful and can solve some problems of some people. The difficult part is to design the interface, trying to make the option not too specific and can interact with other commands or options in CLI. This is a process that needs extreme carefulness and some inspiration. Otherwise the CLI will become a stacking of independent functionalities and be hard to learn and memorize.

I am not rejecting the idea, but to excuse me for not replying this issue. At the same time, I believe it is not hard for you to delete the specific packages from __pypackages__/X.Y/lib manually

frostming avatar Mar 18 '22 11:03 frostming

PDM should not touch site-packages that are globally installed.

cacampbell avatar Apr 20 '23 23:04 cacampbell