pypa / pip

The Python package installer
https://pip.pypa.io/
MIT License
9.53k stars 3.03k forks source link

Only blindly remove scripts for editable installs #7322

Open chrahunt opened 5 years ago

chrahunt commented 5 years ago

What's the problem this feature will solve?

Currently, pip unconditionally removes scripts associated with scripts and entrypoints/console_scripts on uninstallation of a package. That happens here.

This may contribute to problems like #4670 and is in general a bad practice, since there's nothing that ties a Python package to these files.

Describe the solution you'd like

We should only include these scripts for editable installs, i.e. move the block under here.

Legacy installs (setup.py install) and PEP 517 installs both record the set of installed files, to include installed scripts and generated entrypoints. By making this change we reduce the scope of code that is uninstalling files that may have nothing to do with the package in question.

Alternative Solutions

Additional context

None

pradyunsg commented 5 years ago

@chrahunt and I discussed this ~14 hours ago on a call. I'm on board for doing this.

BastienFaure commented 3 years ago

Hey, any update on this issue ? This behavior is still causing pip removing system files. I already proposed help in a previous related ticket a few years ago but if you need anything I can definitely volunteer again.