dependenpy


Namedependenpy JSON
Version 3.3.3 PyPI version JSON
download
home_pageNone
SummaryShow the inter-dependencies between modules of Python packages.
upload_time2025-09-19 10:29:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords dependency analysis matrix dsm
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Dependenpy

[![ci](https://github.com/pawamoy/dependenpy/workflows/ci/badge.svg)](https://github.com/pawamoy/dependenpy/actions?query=workflow%3Aci)
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/dependenpy/)
[![pypi version](https://img.shields.io/pypi/v/dependenpy.svg)](https://pypi.org/project/dependenpy/)
[![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#dependenpy:gitter.im)

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](demo.svg)

## Installation

```bash
pip install dependenpy
```

With [`uv`](https://docs.astral.sh/uv/):

```bash
uv tool install dependenpy
```

## Usage (as a library)

```python
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](https://github.com/Genida/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:

```console
$ # 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│ │ │ │

```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "dependenpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "dependency, analysis, matrix, dsm",
    "author": null,
    "author_email": "=?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>",
    "download_url": "https://files.pythonhosted.org/packages/f6/8d/d65fcb004605eeded97f4797ac3813cedd60abd81450f392ed474c226f1b/dependenpy-3.3.3.tar.gz",
    "platform": null,
    "description": "# Dependenpy\n\n[![ci](https://github.com/pawamoy/dependenpy/workflows/ci/badge.svg)](https://github.com/pawamoy/dependenpy/actions?query=workflow%3Aci)\n[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://pawamoy.github.io/dependenpy/)\n[![pypi version](https://img.shields.io/pypi/v/dependenpy.svg)](https://pypi.org/project/dependenpy/)\n[![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#dependenpy:gitter.im)\n\nShow the inter-dependencies between modules of Python packages.\n\n`dependenpy` allows you to build a dependency matrix for a set of Python packages.\nTo do this, it reads and searches the source code for import statements.\n\n![demo](demo.svg)\n\n## Installation\n\n```bash\npip install dependenpy\n```\n\nWith [`uv`](https://docs.astral.sh/uv/):\n\n```bash\nuv tool install dependenpy\n```\n\n## Usage (as a library)\n\n```python\nfrom dependenpy import DSM\n\n# create DSM\ndsm = DSM('django')\n\n# transform as matrix\nmatrix = dsm.as_matrix(depth=2)\n\n# initialize with many packages\ndsm = DSM('django', 'meerkat', 'appsettings', 'dependenpy', 'archan')\nwith open('output', 'w') as output:\n    dsm.print(format='json', indent=2, output=output)\n\n# access packages and modules\nmeerkat = dsm['meerkat']  # or dsm.get('meerkat')\nfinder = dsm['dependenpy.finder']  # or even dsm['dependenpy']['finder']\n\n# instances of DSM and Package all have print, as_matrix, etc. methods\nmeerkat.print_matrix(depth=2)\n```\n\nThis package was originally design to work in a Django project.\nThe Django package [django-meerkat](https://github.com/Genida/django-meerkat)\nuses it to display the matrices with Highcharts.\n\n## Usage (command-line)\n\n```\nusage: dependenpy [-d DEPTH] [-f {csv,json,text}] [-g] [-G] [-h]\n                  [-i INDENT] [-l] [-m] [-o OUTPUT] [-t] [-v] \n                  [-z STRING] PACKAGES [PACKAGES ...]\n\nCommand line tool for dependenpy Python package.\n\npositional arguments:\n  PACKAGES              The package list. Can be a comma-separated list. Each\n                        package must be either a valid path or a package in\n                        PYTHONPATH.\n\noptional arguments:\n  -d DEPTH, --depth DEPTH\n                        Specify matrix or graph depth. Default: best guess.\n  -f {csv,json,text}, --format {csv,json,text}\n                        Output format. Default: text.\n  -g, --show-graph      Show the graph (no text format). Default: false.\n  -G, --greedy          Explore subdirectories even if they do not contain an\n                        __init__.py file. Can make execution slower. Default:\n                        false.\n  -h, --help            Show this help message and exit.\n  -i INDENT, --indent INDENT\n                        Specify output indentation. CSV will never be\n                        indented. Text will always have new-lines. JSON can be\n                        minified with a negative value. Default: best guess.\n  -l, --show-dependencies-list\n                        Show the dependencies list. Default: false.\n  -m, --show-matrix     Show the matrix. Default: true unless -g, -l or -t.\n  -o OUTPUT, --output OUTPUT\n                        Output to given file. Default: stdout.\n  -t, --show-treemap    Show the treemap (work in progress). Default: false.\n  -v, --version         Show the current version of the program and exit.\n  -z ZERO, --zero ZERO  Character to use for cells with value=0 (text matrix \n                        display only). Default: \"0\".\n\n```\n\nExample:\n\n```console\n$ # running dependenpy on itself\n$ dependenpy dependenpy -z=\n\n                Module \u2502 Id \u25020\u25021\u25022\u25023\u25024\u25025\u25026\u25027\u25028\u2502\n \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u253c\u2500\u253c\u2500\u253c\u2500\u253c\u2500\u253c\u2500\u253c\u2500\u253c\u2500\u253c\u2500\u253c\u2500\u2524\n   dependenpy.__init__ \u2502  0 \u2502 \u2502 \u2502 \u25024\u2502 \u2502 \u2502 \u2502 \u25022\u2502\n   dependenpy.__main__ \u2502  1 \u2502 \u2502 \u25021\u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\n        dependenpy.cli \u2502  2 \u25021\u2502 \u2502 \u25021\u2502 \u25024\u2502 \u2502 \u2502 \u2502\n        dependenpy.dsm \u2502  3 \u2502 \u2502 \u2502 \u2502 \u25022\u25021\u25023\u2502 \u2502 \u2502\n     dependenpy.finder \u2502  4 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\n    dependenpy.helpers \u2502  5 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502\n       dependenpy.node \u2502  6 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u2502 \u25023\u2502\n    dependenpy.plugins \u2502  7 \u2502 \u2502 \u2502 \u25021\u2502 \u25021\u2502 \u2502 \u2502 \u2502\n dependenpy.structures \u2502  8 \u2502 \u2502 \u2502 \u2502 \u2502 \u25021\u2502 \u2502 \u2502 \u2502\n\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Show the inter-dependencies between modules of Python packages.",
    "version": "3.3.3",
    "project_urls": {
        "Changelog": "https://pawamoy.github.io/dependenpy/changelog",
        "Discussions": "https://github.com/pawamoy/dependenpy/discussions",
        "Documentation": "https://pawamoy.github.io/dependenpy",
        "Funding": "https://github.com/sponsors/pawamoy",
        "Gitter": "https://gitter.im/dependenpy/community",
        "Homepage": "https://pawamoy.github.io/dependenpy",
        "Issues": "https://github.com/pawamoy/dependenpy/issues",
        "Repository": "https://github.com/pawamoy/dependenpy"
    },
    "split_keywords": [
        "dependency",
        " analysis",
        " matrix",
        " dsm"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7bbfba79cec11e841e650b48812aeeadfb43e5def83e7799593567cd334392f7",
                "md5": "64968f5cc756e6c712bcc5e8e236887d",
                "sha256": "7b00ba174537d0f4b4ae3cc053d6fb0556fbdf522dcc17435bd654193e967f08"
            },
            "downloads": -1,
            "filename": "dependenpy-3.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "64968f5cc756e6c712bcc5e8e236887d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 25826,
            "upload_time": "2025-09-19T10:29:26",
            "upload_time_iso_8601": "2025-09-19T10:29:26.656313Z",
            "url": "https://files.pythonhosted.org/packages/7b/bf/ba79cec11e841e650b48812aeeadfb43e5def83e7799593567cd334392f7/dependenpy-3.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f68dd65fcb004605eeded97f4797ac3813cedd60abd81450f392ed474c226f1b",
                "md5": "a07f90346377be491bd07230533843bd",
                "sha256": "bdae5a5a714b51f793f59afc3aa08d25f7d312fd35dade115e76a53b46acf975"
            },
            "downloads": -1,
            "filename": "dependenpy-3.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a07f90346377be491bd07230533843bd",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 48982,
            "upload_time": "2025-09-19T10:29:27",
            "upload_time_iso_8601": "2025-09-19T10:29:27.836334Z",
            "url": "https://files.pythonhosted.org/packages/f6/8d/d65fcb004605eeded97f4797ac3813cedd60abd81450f392ed474c226f1b/dependenpy-3.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-19 10:29:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pawamoy",
    "github_project": "dependenpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dependenpy"
}
        
Elapsed time: 1.23770s