tox-dev / pipdeptree

A command line utility to display dependency tree of the installed Python packages

Home Page:https://pypi.python.org/pypi/pipdeptree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[NEW CLIP OPTION IDEA] cli option to control DEPTH of the output tree

loloMD opened this issue · comments

Getting inspiration from the same option of the tree shell command , I think it could be worth to implement a new cli option flag to control the depth of the output.

$ pipdeptree 

backcall==0.2.0
  - ipython==8.13.1 [requires: backcall]
Brotli==1.0.9
cachetools==5.3.0
  - google-auth==2.17.3 [requires: cachetools>=2.0.0,<6.0]
    - google-api-core==2.11.0 [requires: google-auth>=2.14.1,<3.0dev]
      - google-api-python-client==2.86.0 [requires: google-api-core>=1.31.5,<3.0.0dev,!=2.3.0,!=2.2.*,!=2.1.*,!=2.0.*]
    - google-api-python-client==2.86.0 [requires: google-auth>=1.19.0,<3.0.0dev]
    - google-auth-httplib2==0.1.0 [requires: google-auth]
      - google-api-python-client==2.86.0 [requires: google-auth-httplib2>=0.1.0]
    - google-auth-oauthlib==1.0.0 [requires: google-auth>=2.15.0]

Now with the new CLI option

$ pipdeptree -L 2 

backcall==0.2.0
  - ipython==8.13.1 [requires: backcall]
Brotli==1.0.9
cachetools==5.3.0
  - google-auth==2.17.3 [requires: cachetools>=2.0.0,<6.0]
$ pipdeptree -L 3

backcall==0.2.0
  - ipython==8.13.1 [requires: backcall]
Brotli==1.0.9
cachetools==5.3.0
  - google-auth==2.17.3 [requires: cachetools>=2.0.0,<6.0]
    - google-api-core==2.11.0 [requires: google-auth>=2.14.1,<3.0dev]
    - google-api-python-client==2.86.0 [requires: google-auth>=1.19.0,<3.0.0dev]
    - google-auth-httplib2==0.1.0 [requires: google-auth]
    - google-auth-oauthlib==1.0.0 [requires: google-auth>=2.15.0]

PR welcome 😊