Skip to content

Checking our dependency tree

Bruno P. Kinoshita edited this page Oct 5, 2020 · 1 revision

Check for updates available

pypi is our point of truth for dependencies in Python. It is possible to use the web interface at https://pypi.org to search for the latest packages.

It can also be done automatically via pip-check, which is a wrapper to beautify the output of pip list --outdated --format=columns.

Example:

(venv) cylc-flow $ pip install pip-check
...
(venv) cylc-flow $ pip-check
Loading package versions...

┌──────────────────────┬─────────┬────────┬────────────────────────────────────────────┐
│ Major Release Update │ Version │ Latest │                                            │
├──────────────────────┼─────────┼────────┼────────────────────────────────────────────┤
│ aniso8601            │ 7.0.0   │ 8.0.0  │ https://pypi.python.org/pypi/aniso8601     │
│ graphql-core         │ 2.3.2   │ 3.1.2  │ https://pypi.python.org/pypi/graphql-core  │
│ graphql-relay        │ 2.0.1   │ 3.0.0  │ https://pypi.python.org/pypi/graphql-relay │
│ pyzmq                │ 18.1.1  │ 19.0.2 │ https://pypi.python.org/pypi/pyzmq         │
│ Rx                   │ 1.6.1   │ 3.1.1  │ https://pypi.python.org/pypi/Rx            │
│ Werkzeug             │ 0.12.2  │ 1.0.1  │ https://pypi.python.org/pypi/Werkzeug      │
└──────────────────────┴─────────┴────────┴────────────────────────────────────────────┘

┌──────────────────────┬─────────┬────────┬───────────────────────────────────────┐
│ Minor Release Update │ Version │ Latest │                                       │
├──────────────────────┼─────────┼────────┼───────────────────────────────────────┤
│ protobuf             │ 3.12.1  │ 3.13.0 │ https://pypi.python.org/pypi/protobuf │
└──────────────────────┴─────────┴────────┴───────────────────────────────────────┘

┌────────────────────┬───────────┬───────────┬─────────────────────────────────────────────────┐
│ Unchanged Packages │ Version   │ Latest    │                                                 │
├────────────────────┼───────────┼───────────┼─────────────────────────────────────────────────┤
│ aiofiles           │ 0.5.0     │ 0.5.0     │ https://pypi.python.org/pypi/aiofiles           │
...

Looking at the dependency tree

When updating dependencies, or searching for imported modules, looking at the dependency tree of our project can be helpful. That can be achieved with the pipdeptree which works with pip to get the list of dependencies (pip list and conda list can be used too, though without hierarchy).

Example.

(venv) cylc-flow $ pip install pipdeptree
...
(venv) cylc-flow $ pipdeptree
async-generator==1.10
async-timeout==3.0.1
codecov==2.1.9
  - coverage [required: Any, installed: 5.3]
  - requests [required: >=2.7.9, installed: 2.24.0]
    - certifi [required: >=2017.4.17, installed: 2020.6.20]
    - chardet [required: >=3.0.2,<4, installed: 3.0.4]
    - idna [required: >=2.5,<3, installed: 2.10]
    - urllib3 [required: >=1.21.1,<1.26,!=1.25.1,!=1.25.0, installed: 1.25.10]
cylc-flow==8.0a3.dev0
  - aiofiles [required: ==0.5.*, installed: 0.5.0]
  - ansimarkup [required: >=1.0.0, installed: 1.4.0]
    - colorama [required: Any, installed: 0.4.3]
  - click [required: >=7.0, installed: 7.1.2]
  - colorama [required: >=0.4,<=1, installed: 0.4.3]
  - graphene [required: >=2.1,<3, installed: 2.1.8]
    - aniso8601 [required: >=3,<=7, installed: 7.0.0]
    - graphql-core [required: >=2.1,<3, installed: 2.3.
...

You can also pipe it with a program like less to search for dependencies (i.e. pipdeptree | less).