Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Display installed Python projects as a tree of dependencies

Project description

Introduction

Display installed Python projects as a tree of dependencies.

Features

  • Output compatible with requirements.txt
  • Show dependencies or dependents
  • Detect circular dependencies
  • Detect missing dependencies

Usage

$ deptree --help
usage: deptree [-h] [--version] [-r] [-f] [project [project ...]]

Display installed Python projects as a tree of dependencies

positional arguments:
  project        name of project whose dependencies (or dependents) to show

optional arguments:
  -h, --help     show this help message and exit
  --version      show program's version number and exit
  -r, --reverse  show dependent projects instead of dependencies
  -f, --flat     show flat list instead of tree

Examples

$ deptree cryptography
cryptography==2.9  # cryptography
  cffi==1.14.0  # cffi!=1.11.3,>=1.8
    pycparser==2.20  # pycparser
  six==1.14.0  # six>=1.4.1
$ deptree --reverse cryptography
cryptography==2.9  # -
  SecretStorage==3.1.2  # cryptography
    keyring==21.2.0  # SecretStorage>=3; sys_platform == "linux"
      twine==3.1.1  # keyring>=15.1
$ deptree --flat cryptography
cffi==1.14.0
# pycparser

cryptography==2.9
# six>=1.4.1
# cffi!=1.11.3,>=1.8

pycparser==2.20

six==1.14.0
$ deptree --flat --reverse cryptography
# SecretStorage: cryptography
cryptography==2.9

# twine: keyring>=15.1
keyring==21.2.0

# keyring: SecretStorage>=3; sys_platform == "linux"
SecretStorage==3.1.2

twine==3.1.1
$ deptree CircularDependencyA
CircularDependencyA==0.0.0  # CircularDependencyA
  CircularDependencyB==0.0.0  # CircularDependencyB
    CircularDependencyA  # !!! CIRCULAR CircularDependencyA

Installation

For better comfort, use as a single-file isolated zipapp:

For example:

$ python3 -m pip install --target ./deptree/ deptree
$ python3 -m zipapp --python '/usr/bin/env python3' --main 'deptree.cli:main' ./deptree/
$ mv ./deptree.pyz ~/.local/bin/deptree

Or use zapp, or toolmaker.

This way the tool can be used in virtual environments without installing it in the virtual environments. The tool can then see the projects installed in the virtual environment but without seeing itself.

Details

Similar projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for deptree, version 0.0.10
Filename, size File type Python version Upload date Hashes
Filename, size deptree-0.0.10-py3-none-any.whl (10.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size deptree-0.0.10.tar.gz (11.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page