Skip to content

VisualizingRequirements

Anthony Sottile edited this page Oct 17, 2017 · 3 revisions
  1. Enter a built virtualenv of the package / service
  2. Run this script

For example (using paasta as an example)

$ virtualenv venv
$ . venv/bin/activate
$ pip install -rrequirements.txt requirements-tools
$ visualize-requirements requirements.txt
$ visualize-requirements requirements.txt 
 pystaticconfiguration==0.9.0
   - six
 pyyaml==3.11
 pygments==2.0.2
 argcomplete==0.8.1
 argparse==1.2.1
 backports.ssl-match-hostname==3.4.0.2
 blessings==1.6
 boto3==1.3.0
   - futures<4.0.0,>=2.2.0
   - jmespath<1.0.0,>=0.7.1
   - botocore>=1.4.1,<1.5.0
     - docutils>=0.10
     - jmespath<1.0.0,>=0.7.1
     - python-dateutil<3.0.0,>=2.1
       - six>=1.5
 chronos-python==0.34.0
   - httplib2>=0.9
 cookiecutter==1.4.0
   - whichcraft>=0.1.1
   - future>=0.15.2
   - poyo>=0.1.0
   - click>=5.0
   - jinja2>=2.7
     - markupsafe
   - binaryornot>=0.2.0
     - chardet>=2.0.0
   - jinja2-time>=0.1.0
     - jinja2
       - markupsafe
     - arrow
       - python-dateutil
         - six>=1.5
 docker-py==1.2.3
   - six>=1.3.0
   - requests>=2.5.2
   - websocket-client>=0.11.0
     - six
     - backports.ssl-match-hostname
 dulwich==0.10.0
 future>=0.15.2
 futures==3.0.1
 httplib2==0.9
 humanize==0.5.1
 importlib==1.0.3
 isodate==0.5.1
 jsonschema==2.5.1
   - functools32
 kazoo==2.2
   - six
 lockfile==0.9.1
 marathon==0.8.1
   - sseclient
     - six
     - requests>=2.0.0
   - requests>=2.0.0
 mccabe==0.3.1
 mesos.cli==0.1.5
   - argcomplete>=0.8.0
   - kazoo>=2.0
     - six
   - prettytable>=0.7.2
   - protobuf>=2.5.0,<3
     - setuptools
   - blessings>=1.5.1
   - requests>=2.3.0
   - futures>=2.1.6
   - ordereddict>=1.1
   - mesos.interface>=0.20.0
     - protobuf>=2.5.0,<3
       - setuptools
     - google-common>=0.0.1
   - importlib>=1.0.3
 mesos.interface==0.28.0
   - protobuf>=2.5.0,<3
     - setuptools
   - google-common>=0.0.1
 ordereddict==1.1
 path.py==8.1
 ply==3.4
 prettytable==0.7.2
 protobuf==2.6.1
   - setuptools
 pyasn1==0.1.8
 pycrypto==2.6.1
 pysensu-yelp==0.2.2
   - ordereddict
 python-daemon==1.5.2
   - lockfile>=0.7
   - setuptools
 python-dateutil==2.4.2
   - six>=1.5
 pytimeparse==1.1.5
 pytz==2014.10
 requests==2.6.2
 requests-cache==0.4.10
   - requests>=1.1.0
 sensu-plugin==0.1.0
 service-configuration-lib==0.10.0
   - pyyaml>=3.0
 simplejson==3.6.5
 six==1.9.0
 thriftpy==0.1.15
   - ply==3.4
 tron==0.6.1.1
   - pytz>=2011n
   - pycrypto>=2.4
   - pyasn1>=0.0.13
   - twisted<=12.3,>=10.0.0
     - zope.interface>=3.6.0
       - setuptools
   - python-daemon>=1.5.2
     - lockfile>=0.7
     - setuptools
   - pyyaml>=3.0
   - lockfile>=0.7
 websocket-client==0.32.0
   - six
   - backports.ssl-match-hostname
 wsgiref==0.1.2
 yelp-clog==2.2.10
   - thriftpy==0.1.15
     - ply==3.4
   - future>=0.14.0
   - boto>=2.0.0
   - pystaticconfiguration>=0.8
     - six
   - simplejson
 zope.interface==4.1.2
   - setuptools

To see just top-level dependencies you can do something like this:

$ visualize-requirements.py requirements.txt | grep -v '^  '
 pystaticconfiguration==0.9.0
 pyyaml==3.11
 pygments==2.0.2
 argcomplete==0.8.1
 argparse==1.2.1
 backports.ssl-match-hostname==3.4.0.2
 blessings==1.6
 boto3==1.3.0
 chronos-python==0.34.0
 cookiecutter==1.4.0
 docker-py==1.2.3
 dulwich==0.10.0
 future>=0.15.2
 futures==3.0.1
 httplib2==0.9
 humanize==0.5.1
 importlib==1.0.3
 isodate==0.5.1
 jsonschema==2.5.1
 kazoo==2.2
 lockfile==0.9.1
 marathon==0.8.1
 mccabe==0.3.1
 mesos.cli==0.1.5
 mesos.interface==0.28.0
 ordereddict==1.1
 path.py==8.1
 ply==3.4
 prettytable==0.7.2
 protobuf==2.6.1
 pyasn1==0.1.8
 pycrypto==2.6.1
 pysensu-yelp==0.2.2
 python-daemon==1.5.2
 python-dateutil==2.4.2
 pytimeparse==1.1.5
 pytz==2014.10
 requests==2.6.2
 requests-cache==0.4.10
 sensu-plugin==0.1.0
 service-configuration-lib==0.10.0
 simplejson==3.6.5
 six==1.9.0
 thriftpy==0.1.15
 tron==0.6.1.1
 websocket-client==0.32.0
 wsgiref==0.1.2
 yelp-clog==2.2.10
 zope.interface==4.1.2

Top level dependencies which depend on six (on old versions of grep, don't use -z and use GREP_OPTIONS= in case you configure GREP_OPTIONS=--line-buferred):

$ visualize-requirements requirements.txt | grep -E '^ ([^ ]|  - six)' | grep -Pzo '.+\n   .+'
 pystaticconfiguration==0.9.0
   - six
 docker-py==1.2.3
   - six>=1.3.0
 kazoo==2.2
   - six
 python-dateutil==2.4.2
   - six>=1.5
 websocket-client==0.32.0
   - six
Clone this wiki locally