pypa / pip

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

Grouping packages installed by pip #4010

Closed ansumanbebarta closed 7 years ago

ansumanbebarta commented 7 years ago

I see packages installed to pip belong to different categories. For example, in my case I mainly see 3 different types of packages.

  1. Packages used in project
  2. Packages used only for testing (no need to send to production)
  3. Packages required for IDE (for example I use emacs and I need different python packages)

Now I can store these different types of packages in 3 different requirement files and I can install separately. For example:

  1. requirement_project.txt
  2. requirement_test.txt
  3. requirement_dev.txt

But I need a feature by which I can do a pip freeze with passing some options to give me packages belonging to a single group.

I am not sure whether we have such features now. As per my search it's not there. If it is there please guide me. Otherwise we can decided to have this feature.

code-R commented 7 years ago

👍

ppcmiranda commented 7 years ago

My suggestion is to add a -dev optional parameter to pip (example: pip install -dev ). When enabled, pip would install the package as it normally do an add its name to a .pipfreezeignore file placed in a pre-determined directory. So, when pip freeze is used, pip would run as usual and, when writing the requirements.txt file, it would skip the packages which are listed in the .pipfreezeignore file, generating a "production" requirements.txt.

dstufft commented 7 years ago

Closing this, this is something that we're unlikely to add although the Requirements 2.0 effort (#1795) may get it close enough to satisfy your use case.