Description
I'm opening this to discuss the opportunity to implement https://www.python.org/dev/peps/pep-0376/#requested. I'm willing to work on it, if there is agreement about its usefulness.
What's the problem this feature will solve?
It is currently not possible to discover, in the database of installed distribution, which distributions were installed by the user and which distributions were installed as dependencies.
Implementing the REQUESTED file would enable use cases such as smart uninstall (e.g. informing the users about possibly unneeded distributions) #5823
Describe the solution you'd like
Generate the REQUESTED
file in pip install
for top level requirements, i.e. provided by the user on the command line and packages provided via requirements files (-r
option).
In a second stage, the freeze command could evolve a mechanism to output top level requirements on the one hand, and constraints for dependencies on the other hand, enabling a pip freeze | pip install
loop that would preserve REQUESTEDness of distributions.
Alternative Solutions
Some higher level tools such as poetry
implement this via their own requirement/lockfile format. pip-tools
seems to achieve a similar goal with comments in the requirements file.
Having this standardized metadata piece implemented by pip would simplify the creation of such higher level tools, in addition to enabling additional pip use cases.
Note: flit
, when used as an installer, implements the REQUESTED
file.