pydeps


Namepydeps JSON
Version 1.12.20 PyPI version JSON
download
home_pagehttps://github.com/thebjorn/pydeps
SummaryDisplay module dependencies
upload_time2024-03-18 14:53:34
maintainer
docs_urlhttps://pythonhosted.org/pydeps/
authorbjorn
requires_python
licenseBSD
keywords python module dependency graphs
VCS
bugtrack_url
requirements setuptools setuptools PyYAML enum34 stdlib-list tomlkit coverage pytest pytest-cov Sphinx
Travis-CI No Travis.
coveralls test coverage
            pydeps
======

.. image:: https://readthedocs.org/projects/pydeps/badge/?version=latest
   :target: https://readthedocs.org/projects/pydeps/?badge=latest
   :alt: Documentation Status

.. image:: https://github.com/thebjorn/pydeps/actions/workflows/ci-cd.yml/badge.svg
   :target: https://github.com/thebjorn/pydeps/actions/workflows/ci-cd.yml

.. image:: https://codecov.io/gh/thebjorn/pydeps/branch/master/graph/badge.svg?token=VsYwrSFcJa
   :target: https://codecov.io/gh/thebjorn/pydeps

.. image:: https://pepy.tech/badge/pydeps
   :target: https://pepy.tech/project/pydeps
   :alt: Downloads

Python module dependency visualization.

This package is primarily intended to be used from the command line through the
``pydeps`` command.

.. contents::
   :depth: 2


**Feature requests and bug reports:**

Please report bugs and feature requests on GitHub at
https://github.com/thebjorn/pydeps/issues

How to install
--------------
::

    pip install pydeps

To create graphs with ``pydeps`` you also need to install Graphviz_. Please follow the
installation instructions provided in the Graphviz link (and make
sure the ``dot`` command is on your path).

Usage
------------------
::

    usage: pydeps [-h] [--debug] [--config FILE] [--no-config] [--version] [-L LOG]
                  [--find-package] [-v] [-o file] [-T FORMAT] [--display PROGRAM]
                  [--noshow] [--show-deps] [--show-raw-deps] [--deps-output DEPS_OUT]
                  [--show-dot] [--dot-output DOT_OUT] [--nodot] [--no-output]
                  [--show-cycles] [--debug-mf INT] [--noise-level INT]
                  [--max-bacon INT] [--max-module-depth INT] [--pylib] [--pylib-all]
                  [--include-missing] [-x PATTERN [PATTERN ...]]
                  [-xx MODULE [MODULE ...]] [--only MODULE_PATH [MODULE_PATH ...]]
                  [--externals] [--reverse] [--rankdir {TB,BT,LR,RL}] [--cluster]
                  [--min-cluster-size INT] [--max-cluster-size INT]
                  [--keep-target-cluster] [--collapse-target-cluster]
                  [--rmprefix PREFIX [PREFIX ...]] [--start-color INT]
                  fname

positional arguments:
  fname                 filename

optional arguments:
  -h, --help                             show this help message and exit
  --debug                                turn on all the show and verbose options (mainly for debugging pydeps itself)
  --config FILE                          specify config file
  --no-config                            disable processing of config files
  --version                              print pydeps version
  -L LOG, --log LOG                      set log-level to one of CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET.
  --find-package                         tries to automatically find the name of the current package.
  -v, --verbose                          be more verbose (-vv, -vvv for more verbosity)
  -o file                                write output to 'file'
  -T FORMAT                              output format (svg|png)
  --display PROGRAM                      program to use to display the graph (png or svg file depending on the T parameter)
  --noshow, --no-show                    don't call external program to display graph
  --show-deps                            show output of dependency analysis
  --show-raw-deps                        show output of dependency analysis before removing skips
  --deps-output                          write output of dependency analysis to file (instead of screen)
  --show-dot                             show output of dot conversion
  --dot-output                           write dot code to file (instead of screen)
  --nodot, --no-dot                      skip dot conversion
  --no-output                            don't create .svg/.png file, implies --no-show (-t/-o will be ignored)
  --show-cycles                          show only import cycles
  --debug-mf INT                         set the ModuleFinder.debug flag to this value
  --noise-level INT                      exclude sources or sinks with degree greater than noise-level
  --max-bacon INT                        exclude nodes that are more than n hops away (default=2, 0 -> infinite)
  --max-module-depth INT                 coalesce deep modules to at most n levels
  --pylib                                include python std lib modules
  --pylib-all                            include python all std lib modules (incl. C modules)
  --include-missing                      include modules that are not installed (or can't be found on sys.path)
  --only MODULE_PATH                     only include modules that start with MODULE_PATH, multiple paths can be provided
  --externals                            create list of direct external dependencies
  --reverse                              draw arrows to (instead of from) imported modules
  --rankdir                              set the direction of the graph, legal values are TB (default, imported modules above importing modules), BT (opposite direction of TB), LR (left-to-right), and RL (right-to-left)
  --cluster                              draw external dependencies as separate clusters
  --min-cluster-size INT                 the minimum number of nodes a dependency must have before being clustered (default=0)
  --max-cluster-size INT                 the maximum number of nodes a dependency can have before the cluster is collapsed to a single node (default=0)
  --keep-target-cluster                  draw target module as a cluster
  --collapse-target-cluster              collapse target module (this implies --cluster)
  --rmprefix PREFIX                      remove PREFIX from the displayed name of the nodes (multiple prefixes can be provided)
  -x PATTERN, --exclude PATTERN          input files to skip (e.g. `foo.*`), multiple patterns can be provided
  --exclude-exact MODULE                 (shorthand -xx MODULE) same as --exclude, except requires the full match. `-xx foo.bar` will exclude foo.bar, but not foo.bar.blob

**Note:** if an option with a variable number of arguments (like ``-x``) is provided
before ``fname``, separate the arguments from the filename with ``--`` otherwise ``fname``
will be parsed as an argument of the option. Example: ``$ pydeps -x os sys -- pydeps``.

You can of course also import ``pydeps`` from Python and use it as a library, look in
``tests/test_relative_imports.py`` for examples.

Example
-------

This is the result of running ``pydeps`` on itself (``pydeps pydeps``):

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps.svg?sanitize=true

(full disclosure: this is for an early version of pydeps)

Notes
-----------

pydeps finds imports by looking for import-opcodes in
python bytecodes (think `.pyc` files). Therefore, only imported files
will be found (ie. pydeps will not look at files in your directory that
are not imported). Additionally, only files that can be found using
the Python import machinery will be considered (ie. if a module is
missing or not installed, it will not be included regardless if it is
being imported). This can be modified by using the ``--include-missing``
flag.

**Displaying the graph:**

To display the resulting ``.svg`` or ``.png`` files, ``pydeps`` by default
calls an appropriate opener for the platform, like ``xdg-open foo.svg``.

This can be overridden with the ``--display PROGRAM`` option, where ``PROGRAM`` is an
executable that can display the image file of the graph.

You can also export the name of such a viewer in either the ``PYDEPS_DISPLAY``
or ``BROWSER`` environment variable, which changes the default behaviour
when ``--display`` is not used.

Configuration files
-------------------

All options can also be set in a ``.pydeps`` file using ``.ini`` file
syntax (parsable by ``ConfigParser``). Command line options override
options in the ``.pydeps`` file in the current directory, which again
overrides options in the user's home directory
(``%USERPROFILE%\.pydeps`` on Windows and ``${HOME}/.pydeps``
otherwise).

An example .pydeps file::

    [pydeps]
    max_bacon = 2
    no_show = True
    verbose = 0
    pylib = False
    exclude =
        os
        re
        sys
        collections
        __future__

pydeps will also look for configuration data in ``pyproject.toml`` (under
``[tool.pydeps]``) and ``setup.cfg`` (under ``[pydeps]``).

Bacon (Scoring)
---------------

``pydeps`` also contains an Erdős-like scoring function (a.k.a. Bacon
number, from Six degrees of Kevin Bacon
(http://en.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon) that lets
you filter out modules that are more than a given number of 'hops'
away from the module you're interested in.  This is useful for finding
the interface a module has to the rest of the world.

To find pydeps' interface to the Python stdlib (less some very common
modules).

::

    shell> pydeps pydeps --show --max-bacon 2 --pylib -x os re types _* enum

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-pylib.svg?sanitize=true

``--max-bacon 2`` (the default) gives the modules that are at most 2
hops away, and modules that belong together have similar colors.
Compare that to the output with the ``--max-bacon=0`` (infinite)
filter:

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-pylib-all.svg?sanitize=true
   :width: 40%

Import cycles
-------------

``pydeps`` can detect and display cycles with the ``--show-cycles``
parameter.  This will _only_ display the cycles, and for big libraries
it is not a particularly fast operation.  Given a folder with the
following contents (this uses yaml to define a directory structure,
like in the tests)::

        relimp:
            - __init__.py
            - a.py: |
                from . import b
            - b.py: |
                from . import a

``pydeps relimp --show-cycles`` displays:

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-cycle.svg?sanitize=true


.. _clustering:

Clustering
----------

Running `pydeps pydeps --max-bacon=4` on version 1.8.0 of pydeps gives the following graph:

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4.svg?sanitize=true

If you are not interested in the internal structure of external modules, you can add the ``--cluster`` flag, which
will collapse external modules into folder-shaped objects::

    shell> pydeps pydeps --max-bacon=4 --cluster

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster.svg?sanitize=true

To see the internal structure _and_ delineate external modules, use the ``--max-cluster-size`` flag, which controls
how many nodes can be in a cluster before it is collapsed to a folder icon::

    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=1000

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max1000.svg?sanitize=true

or, using a smaller max-cluster-size::

    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max3.svg?sanitize=true

To remove clusters with too few nodes, use the ``--min-cluster-size`` flag::

    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3 --min-cluster-size=2

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max3-min2.svg?sanitize=true

In some situations it can be useful to draw the target module as a cluster::

    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3 --min-cluster-size=2 --keep-target-cluster

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max3-min2-keep-target.svg?sanitize=true

..and since the cluster boxes include the module name, we can remove those prefixes::

    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3 --min-cluster-size=2 --keep-target-cluster --rmprefix pydeps. stdlib_list.

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rmprefix.svg?sanitize=true

.. _maximum_module_depth:

Maximum module depth
--------------------

For Python packages that have a module structure more than two levels deep, the graph can easily become overwhelmingly complex.
Use the ``--max-module-depth=n`` flag to examine the internal dependencies of a package while limiting the module depth
(private and testing-related modules are removed to further simplify the graph using ``-x ...``)::

    shell> pydeps pandas --only pandas --max-module-depth=2 -x pandas._* pandas.test* pandas.conftest

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pandas-max-module-depth.svg?sanitize=true

Graph direction
---------------

The direction of the graph can be specified using the ``--rankdir`` flag.

Top to bottom (default)::

    shell> pydeps pydeps --rankdir TB

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-tb.svg?sanitize=true

Bottom to top::

    shell> pydeps pydeps --rankdir BT

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-bt.svg?sanitize=true

Left to right::

    shell> pydeps pydeps --rankdir LR

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-lr.svg?sanitize=true

Right to left::

    shell> pydeps pydeps --rankdir RL

.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-rl.svg?sanitize=true

Collapsing target package
-------------------------

When internal target package dependencies are unimportant, they can be collapsed using the ``--collapse-target-cluster`` flag. This option also implies ``--cluster``::

    shell> pydeps pydeps --collapse-target-cluster

.. image:: https://raw.githubusercontent.com/mlga/pydeps/collapse-target/docs/_static/pydeps-collapse-target-cluster.svg?sanitize=true

Intermediate format
-------------------

An attempt has been made to keep the intermediate formats readable,
eg. the output from ``pydeps --show-deps ..`` looks like this::

    ...
    "pydeps.mf27": {
        "imported_by": [
            "__main__",
            "pydeps.py2depgraph"
        ],
        "kind": "imp.PY_SOURCE",
        "name": "pydeps.mf27",
        "path": "pydeps\\mf27.py"
    },
    "pydeps.py2depgraph": {
        "imported_by": [
            "__main__",
            "pydeps.pydeps"
        ],
        "imports": [
            "pydeps.depgraph",
            "pydeps.mf27"
        ],
        "kind": "imp.PY_SOURCE",
        "name": "pydeps.py2depgraph",
        "path": "pydeps\\py2depgraph.py"
    }, ...

Version history
---------------

**Version 1.12.19** Thanks to wiguwbe_ for a PR that fixes an inconsistency with 
the ``--no-dot`` flag.

**Version 1.12.13** Better docs for larger packages.
See maximum_module_depth_ for an example.
Thanks to sheromon_ for the PR.

**Version 1.12.5** Pydeps can now read configuration data from ``pyproject.toml``.
Thanks to septatrix_ for pushing the idea and for countering my toml-rant with
an informative argument.

**Version 1.11.0** drop support for Python 3.6.
Thanks to pawamoy_ for removing imports of the deprecated ``imp`` module.
(Parts of it has been vendorized due to a Python bug, see the code for details.)

**Version 1.10.1** Thanks to vector400_ for a new option ``--rankdir`` which
renders the graph in different directions.

**Version 1.10.0** supports Python 3.10.

**Version 1.9.15** Thanks to `Pipeline Foundation`_ for a very much improved CI
pipeline, and a CD pipeline as well.

**Version 1.9.14** Thanks to poneill_ for fixing a cryptic error message when
run in a directory without an ``__init__.py`` file.

**Version 1.9.13** Thanks to glumia_ and SimonBiggs_ for improving the documentation.

**Version 1.9.10** ``no_show`` is now honored when placed in ``.pydeps`` file.
Thanks to romain-dartigues_ for the PR.

**Version 1.9.8** Fix for ``maximum recursion depth exceeded`` when using large
frameworks (like ``sympy``).  Thanks to tanujkhattar_ for finding the fix and to
balopat_ for reporting it.

**Version 1.9.7** Check ``PYDEPS_DISPLAY`` and ``BROWSER`` for a program to open
the graph, PR by jhermann_

..
    **Version 1.9.4** pydeps is now available as a pre-commit.com hook thanks to
    a PR by ewen-lbh_

**Version 1.9.1** graphs are now stable on Python 3.x as well -
this was already the case for Py2.7 (thanks to pawamoy_ for reporting
and testing the issue and to kinow_ for helping with testing).

**Version 1.9.0** supports Python 3.8.

**Version 1.8.7** includes a new flag ``--rmprefix`` which lets you remove
prefixes from the node-labels in the graph. The _name_ of the nodes are not effected
so this does not cause merging of nodes, nor does it change coloring - but it
can lead to multiple nodes with the same label (hovering over the node will
give the full name). Thanks to  aroberge_ for the enhancement request.

**Version 1.8.5** With svg as the output format (which is the default),
paths are now hilighted on mouse hover (thanks to tomasito665_ for the
enhancement request).

**Version 1.8.2** incldes a new flag ``--only`` that causes pydeps to
only report on the paths specified::

    shell> pydeps mypackage --only mypackage.a mypackage.b

**Version 1.8.0** includes 4 new flags for drawing external dependencies as
clusters. See clustering_ for examples.
Additionally, the arrowheads now have the color of the source node.

**Version 1.7.3** includes a new flag ``-xx`` or ``--exclude-exact`` which
matches the functionality of the ``--exclude`` flag, except it requires an
exact match, i.e. ``-xx foo.bar`` will exclude foo.bar, but not
``foo.bar.blob`` (thanks to AvenzaOleg_ for the PR).

**Version 1.7.2** includes a new flag, ``--no-output``, which prevents
creation of the .svg/.png file.

**Version 1.7.1** fixes excludes in .pydeps files (thanks to eqvis_
for the bug report).

**Version 1.7.0** The new ``--reverse`` flag reverses the direction
of the arrows in the dependency graph, so they point _to_ the imported
module instead of _from_ the imported module (thanks to goetzk_ for
the bug report and tobiasmaier_ for the PR!).

**Version 1.5.0** Python 3 support (thanks to eight04_ for the PR).

**Version 1.3.4** ``--externals`` will now include modules that
haven't been installed (what ``modulefinder`` calls ``badmodules``).

**Version 1.2.8** A shortcut for finding the direct external dependencies
of a package was added::

    pydeps --externals mypackage

which will print a json formatted list of module names to the screen, e.g.::

    (dev) go|c:\srv\lib\dk-tasklib> pydeps --externals dktasklib
    [
        "dkfileutils"
    ]

which means that the ``dktasklib`` package only depends on the ``dkfileutils``
package.

This functionality is also available programmatically::

    import os
    from pydeps.pydeps import externals
    # the directory that contains setup.py (one level up from actual package):
    os.chdir('package-directory')
    print externals('mypackage')

**Version 1.2.5:** The defaults are now sensible, such that::

    shell> pydeps mypackage

will likely do what you want. It is the same as
``pydeps --show --max-bacon=2 mypackage`` which means display the
dependency graph in your browser, but limit it to two hops (which
includes only the modules that your module imports -- not continuing
down the import chain).  The old default behavior is available with
``pydeps --noshow --max-bacon=0 mypackage``.

Contributing
------------
#. Fork it
#. It is appreciated (but not required) if you raise an issue first: https://github.com/thebjorn/pydeps/issues
#. Create your feature branch (`git checkout -b my-new-feature`)
#. Commit your changes (`git commit -am 'Add some feature'`)
#. Push to the branch (`git push origin my-new-feature`)
#. Create new Pull Request

.. _Graphviz: http://www.graphviz.org/download/
.. _AvenzaOleg: https://github.com/avenzaoleg
.. _eqvis: https://github.com/eqvis
.. _goetzk: https://github.com/goetzk
.. _tobiasmaier: https://github.com/tobiasmaier
.. _eight04: https://github.com/eight04
.. _tomasito665: https://github.com/Tomasito665
.. _aroberge: https://github.com/aroberge
.. _pawamoy: https://github.com/pawamoy
.. _kinow: https://github.com/kinow
.. _ewen-lbh: https://github.com/ewen-lbh
.. _jhermann: https://github.com/jhermann
.. _balopat: https://github.com/balopat
.. _tanujkhattar: https://github.com/tanujkhattar
.. _romain-dartigues: https://github.com/romain-dartigues
.. _glumia: https://github.com/glumia
.. _SimonBiggs: https://github.com/SimonBiggs
.. _poneill: https://github.com/poneill
.. _Pipeline Foundation: https://pipeline.foundation
.. _vector400: https://github.com/vector400
.. _pawamoy: https://github.com/pawamoy
.. _septatrix: https://github.com/septatrix
.. _sheromon: https://github.com/sheromon
.. _wiguwbe: https://github.com/Wiguwbe

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thebjorn/pydeps",
    "name": "pydeps",
    "maintainer": "",
    "docs_url": "https://pythonhosted.org/pydeps/",
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Python Module Dependency graphs",
    "author": "bjorn",
    "author_email": "bp@datakortet.no",
    "download_url": "https://files.pythonhosted.org/packages/fa/54/9dc92e7e15dfaef6a9176c4187d645b4929162311c82dd4b54eb087d10df/pydeps-1.12.20.tar.gz",
    "platform": null,
    "description": "pydeps\n======\n\n.. image:: https://readthedocs.org/projects/pydeps/badge/?version=latest\n   :target: https://readthedocs.org/projects/pydeps/?badge=latest\n   :alt: Documentation Status\n\n.. image:: https://github.com/thebjorn/pydeps/actions/workflows/ci-cd.yml/badge.svg\n   :target: https://github.com/thebjorn/pydeps/actions/workflows/ci-cd.yml\n\n.. image:: https://codecov.io/gh/thebjorn/pydeps/branch/master/graph/badge.svg?token=VsYwrSFcJa\n   :target: https://codecov.io/gh/thebjorn/pydeps\n\n.. image:: https://pepy.tech/badge/pydeps\n   :target: https://pepy.tech/project/pydeps\n   :alt: Downloads\n\nPython module dependency visualization.\n\nThis package is primarily intended to be used from the command line through the\n``pydeps`` command.\n\n.. contents::\n   :depth: 2\n\n\n**Feature requests and bug reports:**\n\nPlease report bugs and feature requests on GitHub at\nhttps://github.com/thebjorn/pydeps/issues\n\nHow to install\n--------------\n::\n\n    pip install pydeps\n\nTo create graphs with ``pydeps`` you also need to install Graphviz_. Please follow the\ninstallation instructions provided in the Graphviz link (and make\nsure the ``dot`` command is on your path).\n\nUsage\n------------------\n::\n\n    usage: pydeps [-h] [--debug] [--config FILE] [--no-config] [--version] [-L LOG]\n                  [--find-package] [-v] [-o file] [-T FORMAT] [--display PROGRAM]\n                  [--noshow] [--show-deps] [--show-raw-deps] [--deps-output DEPS_OUT]\n                  [--show-dot] [--dot-output DOT_OUT] [--nodot] [--no-output]\n                  [--show-cycles] [--debug-mf INT] [--noise-level INT]\n                  [--max-bacon INT] [--max-module-depth INT] [--pylib] [--pylib-all]\n                  [--include-missing] [-x PATTERN [PATTERN ...]]\n                  [-xx MODULE [MODULE ...]] [--only MODULE_PATH [MODULE_PATH ...]]\n                  [--externals] [--reverse] [--rankdir {TB,BT,LR,RL}] [--cluster]\n                  [--min-cluster-size INT] [--max-cluster-size INT]\n                  [--keep-target-cluster] [--collapse-target-cluster]\n                  [--rmprefix PREFIX [PREFIX ...]] [--start-color INT]\n                  fname\n\npositional arguments:\n  fname                 filename\n\noptional arguments:\n  -h, --help                             show this help message and exit\n  --debug                                turn on all the show and verbose options (mainly for debugging pydeps itself)\n  --config FILE                          specify config file\n  --no-config                            disable processing of config files\n  --version                              print pydeps version\n  -L LOG, --log LOG                      set log-level to one of CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET.\n  --find-package                         tries to automatically find the name of the current package.\n  -v, --verbose                          be more verbose (-vv, -vvv for more verbosity)\n  -o file                                write output to 'file'\n  -T FORMAT                              output format (svg|png)\n  --display PROGRAM                      program to use to display the graph (png or svg file depending on the T parameter)\n  --noshow, --no-show                    don't call external program to display graph\n  --show-deps                            show output of dependency analysis\n  --show-raw-deps                        show output of dependency analysis before removing skips\n  --deps-output                          write output of dependency analysis to file (instead of screen)\n  --show-dot                             show output of dot conversion\n  --dot-output                           write dot code to file (instead of screen)\n  --nodot, --no-dot                      skip dot conversion\n  --no-output                            don't create .svg/.png file, implies --no-show (-t/-o will be ignored)\n  --show-cycles                          show only import cycles\n  --debug-mf INT                         set the ModuleFinder.debug flag to this value\n  --noise-level INT                      exclude sources or sinks with degree greater than noise-level\n  --max-bacon INT                        exclude nodes that are more than n hops away (default=2, 0 -> infinite)\n  --max-module-depth INT                 coalesce deep modules to at most n levels\n  --pylib                                include python std lib modules\n  --pylib-all                            include python all std lib modules (incl. C modules)\n  --include-missing                      include modules that are not installed (or can't be found on sys.path)\n  --only MODULE_PATH                     only include modules that start with MODULE_PATH, multiple paths can be provided\n  --externals                            create list of direct external dependencies\n  --reverse                              draw arrows to (instead of from) imported modules\n  --rankdir                              set the direction of the graph, legal values are TB (default, imported modules above importing modules), BT (opposite direction of TB), LR (left-to-right), and RL (right-to-left)\n  --cluster                              draw external dependencies as separate clusters\n  --min-cluster-size INT                 the minimum number of nodes a dependency must have before being clustered (default=0)\n  --max-cluster-size INT                 the maximum number of nodes a dependency can have before the cluster is collapsed to a single node (default=0)\n  --keep-target-cluster                  draw target module as a cluster\n  --collapse-target-cluster              collapse target module (this implies --cluster)\n  --rmprefix PREFIX                      remove PREFIX from the displayed name of the nodes (multiple prefixes can be provided)\n  -x PATTERN, --exclude PATTERN          input files to skip (e.g. `foo.*`), multiple patterns can be provided\n  --exclude-exact MODULE                 (shorthand -xx MODULE) same as --exclude, except requires the full match. `-xx foo.bar` will exclude foo.bar, but not foo.bar.blob\n\n**Note:** if an option with a variable number of arguments (like ``-x``) is provided\nbefore ``fname``, separate the arguments from the filename with ``--`` otherwise ``fname``\nwill be parsed as an argument of the option. Example: ``$ pydeps -x os sys -- pydeps``.\n\nYou can of course also import ``pydeps`` from Python and use it as a library, look in\n``tests/test_relative_imports.py`` for examples.\n\nExample\n-------\n\nThis is the result of running ``pydeps`` on itself (``pydeps pydeps``):\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps.svg?sanitize=true\n\n(full disclosure: this is for an early version of pydeps)\n\nNotes\n-----------\n\npydeps finds imports by looking for import-opcodes in\npython bytecodes (think `.pyc` files). Therefore, only imported files\nwill be found (ie. pydeps will not look at files in your directory that\nare not imported). Additionally, only files that can be found using\nthe Python import machinery will be considered (ie. if a module is\nmissing or not installed, it will not be included regardless if it is\nbeing imported). This can be modified by using the ``--include-missing``\nflag.\n\n**Displaying the graph:**\n\nTo display the resulting ``.svg`` or ``.png`` files, ``pydeps`` by default\ncalls an appropriate opener for the platform, like ``xdg-open foo.svg``.\n\nThis can be overridden with the ``--display PROGRAM`` option, where ``PROGRAM`` is an\nexecutable that can display the image file of the graph.\n\nYou can also export the name of such a viewer in either the ``PYDEPS_DISPLAY``\nor ``BROWSER`` environment variable, which changes the default behaviour\nwhen ``--display`` is not used.\n\nConfiguration files\n-------------------\n\nAll options can also be set in a ``.pydeps`` file using ``.ini`` file\nsyntax (parsable by ``ConfigParser``). Command line options override\noptions in the ``.pydeps`` file in the current directory, which again\noverrides options in the user's home directory\n(``%USERPROFILE%\\.pydeps`` on Windows and ``${HOME}/.pydeps``\notherwise).\n\nAn example .pydeps file::\n\n    [pydeps]\n    max_bacon = 2\n    no_show = True\n    verbose = 0\n    pylib = False\n    exclude =\n        os\n        re\n        sys\n        collections\n        __future__\n\npydeps will also look for configuration data in ``pyproject.toml`` (under\n``[tool.pydeps]``) and ``setup.cfg`` (under ``[pydeps]``).\n\nBacon (Scoring)\n---------------\n\n``pydeps`` also contains an Erd\u0151s-like scoring function (a.k.a. Bacon\nnumber, from Six degrees of Kevin Bacon\n(http://en.wikipedia.org/wiki/Six_Degrees_of_Kevin_Bacon) that lets\nyou filter out modules that are more than a given number of 'hops'\naway from the module you're interested in.  This is useful for finding\nthe interface a module has to the rest of the world.\n\nTo find pydeps' interface to the Python stdlib (less some very common\nmodules).\n\n::\n\n    shell> pydeps pydeps --show --max-bacon 2 --pylib -x os re types _* enum\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-pylib.svg?sanitize=true\n\n``--max-bacon 2`` (the default) gives the modules that are at most 2\nhops away, and modules that belong together have similar colors.\nCompare that to the output with the ``--max-bacon=0`` (infinite)\nfilter:\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-pylib-all.svg?sanitize=true\n   :width: 40%\n\nImport cycles\n-------------\n\n``pydeps`` can detect and display cycles with the ``--show-cycles``\nparameter.  This will _only_ display the cycles, and for big libraries\nit is not a particularly fast operation.  Given a folder with the\nfollowing contents (this uses yaml to define a directory structure,\nlike in the tests)::\n\n        relimp:\n            - __init__.py\n            - a.py: |\n                from . import b\n            - b.py: |\n                from . import a\n\n``pydeps relimp --show-cycles`` displays:\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-cycle.svg?sanitize=true\n\n\n.. _clustering:\n\nClustering\n----------\n\nRunning `pydeps pydeps --max-bacon=4` on version 1.8.0 of pydeps gives the following graph:\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4.svg?sanitize=true\n\nIf you are not interested in the internal structure of external modules, you can add the ``--cluster`` flag, which\nwill collapse external modules into folder-shaped objects::\n\n    shell> pydeps pydeps --max-bacon=4 --cluster\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster.svg?sanitize=true\n\nTo see the internal structure _and_ delineate external modules, use the ``--max-cluster-size`` flag, which controls\nhow many nodes can be in a cluster before it is collapsed to a folder icon::\n\n    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=1000\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max1000.svg?sanitize=true\n\nor, using a smaller max-cluster-size::\n\n    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max3.svg?sanitize=true\n\nTo remove clusters with too few nodes, use the ``--min-cluster-size`` flag::\n\n    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3 --min-cluster-size=2\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max3-min2.svg?sanitize=true\n\nIn some situations it can be useful to draw the target module as a cluster::\n\n    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3 --min-cluster-size=2 --keep-target-cluster\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-18-bacon4-cluster-max3-min2-keep-target.svg?sanitize=true\n\n..and since the cluster boxes include the module name, we can remove those prefixes::\n\n    shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3 --min-cluster-size=2 --keep-target-cluster --rmprefix pydeps. stdlib_list.\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rmprefix.svg?sanitize=true\n\n.. _maximum_module_depth:\n\nMaximum module depth\n--------------------\n\nFor Python packages that have a module structure more than two levels deep, the graph can easily become overwhelmingly complex.\nUse the ``--max-module-depth=n`` flag to examine the internal dependencies of a package while limiting the module depth\n(private and testing-related modules are removed to further simplify the graph using ``-x ...``)::\n\n    shell> pydeps pandas --only pandas --max-module-depth=2 -x pandas._* pandas.test* pandas.conftest\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pandas-max-module-depth.svg?sanitize=true\n\nGraph direction\n---------------\n\nThe direction of the graph can be specified using the ``--rankdir`` flag.\n\nTop to bottom (default)::\n\n    shell> pydeps pydeps --rankdir TB\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-tb.svg?sanitize=true\n\nBottom to top::\n\n    shell> pydeps pydeps --rankdir BT\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-bt.svg?sanitize=true\n\nLeft to right::\n\n    shell> pydeps pydeps --rankdir LR\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-lr.svg?sanitize=true\n\nRight to left::\n\n    shell> pydeps pydeps --rankdir RL\n\n.. image:: https://raw.githubusercontent.com/thebjorn/pydeps/master/docs/_static/pydeps-rankdir-rl.svg?sanitize=true\n\nCollapsing target package\n-------------------------\n\nWhen internal target package dependencies are unimportant, they can be collapsed using the ``--collapse-target-cluster`` flag. This option also implies ``--cluster``::\n\n    shell> pydeps pydeps --collapse-target-cluster\n\n.. image:: https://raw.githubusercontent.com/mlga/pydeps/collapse-target/docs/_static/pydeps-collapse-target-cluster.svg?sanitize=true\n\nIntermediate format\n-------------------\n\nAn attempt has been made to keep the intermediate formats readable,\neg. the output from ``pydeps --show-deps ..`` looks like this::\n\n    ...\n    \"pydeps.mf27\": {\n        \"imported_by\": [\n            \"__main__\",\n            \"pydeps.py2depgraph\"\n        ],\n        \"kind\": \"imp.PY_SOURCE\",\n        \"name\": \"pydeps.mf27\",\n        \"path\": \"pydeps\\\\mf27.py\"\n    },\n    \"pydeps.py2depgraph\": {\n        \"imported_by\": [\n            \"__main__\",\n            \"pydeps.pydeps\"\n        ],\n        \"imports\": [\n            \"pydeps.depgraph\",\n            \"pydeps.mf27\"\n        ],\n        \"kind\": \"imp.PY_SOURCE\",\n        \"name\": \"pydeps.py2depgraph\",\n        \"path\": \"pydeps\\\\py2depgraph.py\"\n    }, ...\n\nVersion history\n---------------\n\n**Version 1.12.19** Thanks to wiguwbe_ for a PR that fixes an inconsistency with \nthe ``--no-dot`` flag.\n\n**Version 1.12.13** Better docs for larger packages.\nSee maximum_module_depth_ for an example.\nThanks to sheromon_ for the PR.\n\n**Version 1.12.5** Pydeps can now read configuration data from ``pyproject.toml``.\nThanks to septatrix_ for pushing the idea and for countering my toml-rant with\nan informative argument.\n\n**Version 1.11.0** drop support for Python 3.6.\nThanks to pawamoy_ for removing imports of the deprecated ``imp`` module.\n(Parts of it has been vendorized due to a Python bug, see the code for details.)\n\n**Version 1.10.1** Thanks to vector400_ for a new option ``--rankdir`` which\nrenders the graph in different directions.\n\n**Version 1.10.0** supports Python 3.10.\n\n**Version 1.9.15** Thanks to `Pipeline Foundation`_ for a very much improved CI\npipeline, and a CD pipeline as well.\n\n**Version 1.9.14** Thanks to poneill_ for fixing a cryptic error message when\nrun in a directory without an ``__init__.py`` file.\n\n**Version 1.9.13** Thanks to glumia_ and SimonBiggs_ for improving the documentation.\n\n**Version 1.9.10** ``no_show`` is now honored when placed in ``.pydeps`` file.\nThanks to romain-dartigues_ for the PR.\n\n**Version 1.9.8** Fix for ``maximum recursion depth exceeded`` when using large\nframeworks (like ``sympy``).  Thanks to tanujkhattar_ for finding the fix and to\nbalopat_ for reporting it.\n\n**Version 1.9.7** Check ``PYDEPS_DISPLAY`` and ``BROWSER`` for a program to open\nthe graph, PR by jhermann_\n\n..\n    **Version 1.9.4** pydeps is now available as a pre-commit.com hook thanks to\n    a PR by ewen-lbh_\n\n**Version 1.9.1** graphs are now stable on Python 3.x as well -\nthis was already the case for Py2.7 (thanks to pawamoy_ for reporting\nand testing the issue and to kinow_ for helping with testing).\n\n**Version 1.9.0** supports Python 3.8.\n\n**Version 1.8.7** includes a new flag ``--rmprefix`` which lets you remove\nprefixes from the node-labels in the graph. The _name_ of the nodes are not effected\nso this does not cause merging of nodes, nor does it change coloring - but it\ncan lead to multiple nodes with the same label (hovering over the node will\ngive the full name). Thanks to  aroberge_ for the enhancement request.\n\n**Version 1.8.5** With svg as the output format (which is the default),\npaths are now hilighted on mouse hover (thanks to tomasito665_ for the\nenhancement request).\n\n**Version 1.8.2** incldes a new flag ``--only`` that causes pydeps to\nonly report on the paths specified::\n\n    shell> pydeps mypackage --only mypackage.a mypackage.b\n\n**Version 1.8.0** includes 4 new flags for drawing external dependencies as\nclusters. See clustering_ for examples.\nAdditionally, the arrowheads now have the color of the source node.\n\n**Version 1.7.3** includes a new flag ``-xx`` or ``--exclude-exact`` which\nmatches the functionality of the ``--exclude`` flag, except it requires an\nexact match, i.e. ``-xx foo.bar`` will exclude foo.bar, but not\n``foo.bar.blob`` (thanks to AvenzaOleg_ for the PR).\n\n**Version 1.7.2** includes a new flag, ``--no-output``, which prevents\ncreation of the .svg/.png file.\n\n**Version 1.7.1** fixes excludes in .pydeps files (thanks to eqvis_\nfor the bug report).\n\n**Version 1.7.0** The new ``--reverse`` flag reverses the direction\nof the arrows in the dependency graph, so they point _to_ the imported\nmodule instead of _from_ the imported module (thanks to goetzk_ for\nthe bug report and tobiasmaier_ for the PR!).\n\n**Version 1.5.0** Python 3 support (thanks to eight04_ for the PR).\n\n**Version 1.3.4** ``--externals`` will now include modules that\nhaven't been installed (what ``modulefinder`` calls ``badmodules``).\n\n**Version 1.2.8** A shortcut for finding the direct external dependencies\nof a package was added::\n\n    pydeps --externals mypackage\n\nwhich will print a json formatted list of module names to the screen, e.g.::\n\n    (dev) go|c:\\srv\\lib\\dk-tasklib> pydeps --externals dktasklib\n    [\n        \"dkfileutils\"\n    ]\n\nwhich means that the ``dktasklib`` package only depends on the ``dkfileutils``\npackage.\n\nThis functionality is also available programmatically::\n\n    import os\n    from pydeps.pydeps import externals\n    # the directory that contains setup.py (one level up from actual package):\n    os.chdir('package-directory')\n    print externals('mypackage')\n\n**Version 1.2.5:** The defaults are now sensible, such that::\n\n    shell> pydeps mypackage\n\nwill likely do what you want. It is the same as\n``pydeps --show --max-bacon=2 mypackage`` which means display the\ndependency graph in your browser, but limit it to two hops (which\nincludes only the modules that your module imports -- not continuing\ndown the import chain).  The old default behavior is available with\n``pydeps --noshow --max-bacon=0 mypackage``.\n\nContributing\n------------\n#. Fork it\n#. It is appreciated (but not required) if you raise an issue first: https://github.com/thebjorn/pydeps/issues\n#. Create your feature branch (`git checkout -b my-new-feature`)\n#. Commit your changes (`git commit -am 'Add some feature'`)\n#. Push to the branch (`git push origin my-new-feature`)\n#. Create new Pull Request\n\n.. _Graphviz: http://www.graphviz.org/download/\n.. _AvenzaOleg: https://github.com/avenzaoleg\n.. _eqvis: https://github.com/eqvis\n.. _goetzk: https://github.com/goetzk\n.. _tobiasmaier: https://github.com/tobiasmaier\n.. _eight04: https://github.com/eight04\n.. _tomasito665: https://github.com/Tomasito665\n.. _aroberge: https://github.com/aroberge\n.. _pawamoy: https://github.com/pawamoy\n.. _kinow: https://github.com/kinow\n.. _ewen-lbh: https://github.com/ewen-lbh\n.. _jhermann: https://github.com/jhermann\n.. _balopat: https://github.com/balopat\n.. _tanujkhattar: https://github.com/tanujkhattar\n.. _romain-dartigues: https://github.com/romain-dartigues\n.. _glumia: https://github.com/glumia\n.. _SimonBiggs: https://github.com/SimonBiggs\n.. _poneill: https://github.com/poneill\n.. _Pipeline Foundation: https://pipeline.foundation\n.. _vector400: https://github.com/vector400\n.. _pawamoy: https://github.com/pawamoy\n.. _septatrix: https://github.com/septatrix\n.. _sheromon: https://github.com/sheromon\n.. _wiguwbe: https://github.com/Wiguwbe\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Display module dependencies",
    "version": "1.12.20",
    "project_urls": {
        "Homepage": "https://github.com/thebjorn/pydeps"
    },
    "split_keywords": [
        "python",
        "module",
        "dependency",
        "graphs"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1d81d67e4335a54c33e73e41204ca46c89c7b64e42fc9ceeb239ae9b68c65e1c",
                "md5": "8d661970c90bb744adebf8e4b3c35df7",
                "sha256": "7278a8912bdada26b773d3550f0cc8fd76bed172d23dc1472c457d6292b67fd7"
            },
            "downloads": -1,
            "filename": "pydeps-1.12.20-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8d661970c90bb744adebf8e4b3c35df7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 46219,
            "upload_time": "2024-03-18T14:53:31",
            "upload_time_iso_8601": "2024-03-18T14:53:31.645041Z",
            "url": "https://files.pythonhosted.org/packages/1d/81/d67e4335a54c33e73e41204ca46c89c7b64e42fc9ceeb239ae9b68c65e1c/pydeps-1.12.20-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa549dc92e7e15dfaef6a9176c4187d645b4929162311c82dd4b54eb087d10df",
                "md5": "74ab42303c8cbaef122e39bff99e5c2a",
                "sha256": "4f6a833a7998bfa24e339c55535882905c22960efc14902c361f74b2952aff19"
            },
            "downloads": -1,
            "filename": "pydeps-1.12.20.tar.gz",
            "has_sig": false,
            "md5_digest": "74ab42303c8cbaef122e39bff99e5c2a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 51106,
            "upload_time": "2024-03-18T14:53:34",
            "upload_time_iso_8601": "2024-03-18T14:53:34.549651Z",
            "url": "https://files.pythonhosted.org/packages/fa/54/9dc92e7e15dfaef6a9176c4187d645b4929162311c82dd4b54eb087d10df/pydeps-1.12.20.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-18 14:53:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thebjorn",
    "github_project": "pydeps",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "setuptools",
            "specs": [
                [
                    "<",
                    "45"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "65.5.1"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    "==",
                    "6.0.1"
                ]
            ]
        },
        {
            "name": "enum34",
            "specs": [
                [
                    "==",
                    "1.0.4"
                ]
            ]
        },
        {
            "name": "stdlib-list",
            "specs": [
                [
                    ">=",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "tomlkit",
            "specs": [
                [
                    ">=",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "coverage",
            "specs": [
                [
                    ">=",
                    "5.5"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "4.6"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    ">=",
                    "2.12.1"
                ]
            ]
        },
        {
            "name": "Sphinx",
            "specs": [
                [
                    ">=",
                    "1.7.6"
                ]
            ]
        }
    ],
    "lcname": "pydeps"
}
        
Elapsed time: 0.21332s