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│ │ │ │

Sponsors

Silver sponsors

FastAPI

Bronze sponsors

Nixtla


ofek samuelcolvin tlambert03 ssbarnea femtomc cmarqu kolenaIO ramnes machow BenHammersley trevorWieland MarcoGorelli analog-cbarber OdinManiac rstudio-sponsorship schlich butterlyn livingbio NemetschekAllplan EricJayHartman 15r10nk activeloopai roboflow cmclaughlin RapidataAI rodolphebarbanneau theSymbolSyndicate blakeNaccarato ChargeStorm Cusp-AI

And 4 more private sponsor(s).

Metadata

Release files for dependenpy 3.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dependenpy 3.3.4
File Size Uploaded
dependenpy-3.3.4.tar.gz 54.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dependenpy 3.3.4
File Interpreter ABI Platform
dependenpy-3.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 91.4 kB

Release files / dependenpy-3.3.4.tar.gz

Download URL dependenpy-3.3.4.tar.gz
Size 54.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1d38c4d157930c1ba8dbea0df9838ecd83aeca15af4185febc1d388deb48bc9a
BLAKE2b-256 checksum
How to use checksums
38b32c417a0ca95cfe80825cdc73b3e82bc8a110e290ff6f06e86d2d355f6381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / dependenpy-3.3.4-py3-none-any.whl

Download URL dependenpy-3.3.4-py3-none-any.whl
Size 37.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
290c48943aa66e8828ab79c0758b57d18e1d7c21ce254f06e9eab047d9c71cc9
BLAKE2b-256 checksum
How to use checksums
95d903a2e2bad1c070c29ab161c3aede6489f4e80d70e9d6fb0d8ec64383d36e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release history Release notifications | RSS feed

This release

3.3.4 This release

2 release files

3.3.3

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.0.3

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.4

1 release file

v1.0.3

1 release file

v1.0.2

1 release file

v1.0.1

1 release file

v1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page