7

I have a three python projects A, B and C. Each depending on each other.

How can I now "clean up" my requirements.txt that only the high level dependencies that are required at this "level" are there.

Example

A requirements:

boto3==1.2.4

B requirements:

A==0.0.1
boto3==1.2.4
cookiecutter==1.4.0

C requirements:

B==0.0.1
slacker==0.9.9
boto3==1.2.4
cookiecutter==1.4.0

The bold packages are the ones which should be filtered out.

lony
  • 6,733
  • 11
  • 60
  • 92
  • Why do you want to do this? If a package is already installed it will be skipped by pip anyway. – Selcuk Jun 22 '16 at 11:40
  • 1
    If I refactor stuff I lose track what is in which package. I want to automate cleaning up my requirements.txt and don'T see duplicates as a good code quality. – lony Jun 22 '16 at 11:43

1 Answers1

8

pipdeptree can display the dependencies tree, and for a given package tell you which other package(s) depends on it.

bruno desthuilliers
  • 75,974
  • 6
  • 88
  • 118