Skip to main content

Dependenpy

ci documentation pypi version gitter

Show the inter-dependencies between modules of Python packages.

dependenpy allows you to build a dependency matrix for a set of Python packages. To do this, it reads and searches the source code for import statements.

demo

Installation

pip install dependenpy

With uv:

uv tool install dependenpy

Usage (as a library)

from dependenpy import DSM

# create DSM
dsm = DSM('django')

# transform as matrix
matrix = dsm.as_matrix(depth=2)

# initialize with many packages
dsm = DSM('django', 'meerkat', 'appsettings', 'dependenpy', 'archan')
with open('output', 'w') as output:
    dsm.print(format='json', indent=2, output=output)

# access packages and modules
meerkat = dsm['meerkat']  # or dsm.get('meerkat')
finder = dsm['dependenpy.finder']  # or even dsm['dependenpy']['finder']

# instances of DSM and Package all have print, as_matrix, etc. methods
meerkat.print_matrix(depth=2)

This package was originally design to work in a Django project. The Django package django-meerkat uses it to display the matrices with Highcharts.

Usage (command-line)

usage: dependenpy [-d DEPTH] [-f {csv,json,text}] [-g] [-G] [-h]
                  [-i INDENT] [-l] [-m] [-o OUTPUT] [-t] [-v] 
                  [-z STRING] PACKAGES [PACKAGES ...]

Command line tool for dependenpy Python package.

positional arguments:
  PACKAGES              The package list. Can be a comma-separated list. Each
                        package must be either a valid path or a package in
                        PYTHONPATH.

optional arguments:
  -d DEPTH, --depth DEPTH
                        Specify matrix or graph depth. Default: best guess.
  -f {csv,json,text}, --format {csv,json,text}
                        Output format. Default: text.
  -g, --show-graph      Show the graph (no text format). Default: false.
  -G, --greedy          Explore subdirectories even if they do not contain an
                        __init__.py file. Can make execution slower. Default:
                        false.
  -h, --help            Show this help message and exit.
  -i INDENT, --indent INDENT
                        Specify output indentation. CSV will never be
                        indented. Text will always have new-lines. JSON can be
                        minified with a negative value. Default: best guess.
  -l, --show-dependencies-list
                        Show the dependencies list. Default: false.
  -m, --show-matrix     Show the matrix. Default: true unless -g, -l or -t.
  -o OUTPUT, --output OUTPUT
                        Output to given file. Default: stdout.
  -t, --show-treemap    Show the treemap (work in progress). Default: false.
  -v, --version         Show the current version of the program and exit.
  -z ZERO, --zero ZERO  Character to use for cells with value=0 (text matrix 
                        display only). Default: "0".

Example:

$ # running dependenpy on itself
$ dependenpy dependenpy -z=

                Module │ Id │0│1│2│3│4│5│6│7│8│
 ──────────────────────┼────┼─┼─┼─┼─┼─┼─┼─┼─┼─┤
   dependenpy.__init__ │  0 │ │ │ │4│ │ │ │ │2│
   dependenpy.__main__ │  1 │ │ │1│ │ │ │ │ │ │
        dependenpy.cli │  2 │1│ │ │1│ │4│ │ │ │
        dependenpy.dsm │  3 │ │ │ │ │2│1│3│ │ │
     dependenpy.finder │  4 │ │ │ │ │ │ │ │ │ │
    dependenpy.helpers │  5 │ │ │ │ │ │ │ │ │ │
       dependenpy.node │  6 │ │ │ │ │ │ │ │ │3│
    dependenpy.plugins │  7 │ │ │ │1│ │1│ │ │ │
 dependenpy.structures │  8 │ │ │ │ │ │1│ │ │ │

Download files

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

Source Distribution

dependenpy-3.3.3.tar.gz (49.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dependenpy-3.3.3-py3-none-any.whl (25.8 kB view details)

Uploaded Python 3

File details

Details for the file dependenpy-3.3.3.tar.gz.

File metadata

  • Download URL: dependenpy-3.3.3.tar.gz
  • Upload date:
  • Size: 49.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for dependenpy-3.3.3.tar.gz
Algorithm Hash digest
SHA256 bdae5a5a714b51f793f59afc3aa08d25f7d312fd35dade115e76a53b46acf975
MD5 a07f90346377be491bd07230533843bd
BLAKE2b-256 f68dd65fcb004605eeded97f4797ac3813cedd60abd81450f392ed474c226f1b

See more details on using hashes here.

File details

Details for the file dependenpy-3.3.3-py3-none-any.whl.

File metadata

  • Download URL: dependenpy-3.3.3-py3-none-any.whl
  • Upload date:
  • Size: 25.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for dependenpy-3.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7b00ba174537d0f4b4ae3cc053d6fb0556fbdf522dcc17435bd654193e967f08
MD5 64968f5cc756e6c712bcc5e8e236887d
BLAKE2b-256 7bbfba79cec11e841e650b48812aeeadfb43e5def83e7799593567cd334392f7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.3.3 This release

2 files

3.3.2

2 files

3.3.1

2 files

3.3.0

2 files

3.2.0

2 files

3.1.0

2 files

3.0.0

2 files

2.0.3

2 files

2.0.1

2 files

2.0.0

2 files

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.4

1 file

v1.0.3

1 file

v1.0.2

1 file

v1.0.1

1 file

v1.0

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page