Display module dependencies
Project description
Python module dependency visualization. This package installs the pydeps command, and normal usage will be to use it from the command line. To install:
pip install pydeps
To create graphs you need to install Graphviz (make sure the dot command is on your path).
This is the result of running pydeps on itself (pydeps --show pydeps):
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).
pydeps pydeps --show --max-bacon 2 --pylib -x os re types _* enum
--max-bacon 2 gives the modules that are at most 2 hops away, and modules that belong together have similar colors. Compare that to the output without the --max-bacon 2 filter:
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:
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" }, ...
Usage:
usage: pydeps-script.py [-h] [-v] [-o file] [-T FORMAT] [--show] [--show-deps] [--show-dot] [--debug] [--pylib] [--pylib-all] [-x EXCLUDE [EXCLUDE ...]] fname positional arguments: fname filename optional arguments: -h, --help show this help message and exit -v, --verbose be more verbose (-vv, -vvv for more verbosity) -o file write output to 'file' -T FORMAT output format (svg|png) --show call external program to display graph --show-deps show output of dependency analysis --show-dot show output of dot conversion --debug turn on all the show and verbose options --pylib include python std lib modules --pylib-all include python all std lib modules (incl. C modules) -x EXCLUDE [EXCLUDE ...], --exclude EXCLUDE [EXCLUDE ...] input files to skip
You can of course import pydeps from Python (look in the tests/test_relative_imports.py file for examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file pydeps-1.1.1.zip
.
File metadata
- Download URL: pydeps-1.1.1.zip
- Upload date:
- Size: 27.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09802983219aff48fa543f4565351321fcd89c68843afb26ed8ffb25ab1f89e0 |
|
MD5 | e58c893eca6e554e473d90594fc09745 |
|
BLAKE2b-256 | 5dac215ee81f150c3c17e43e90491ef5ac744ff02013b06293fedfacba1606de |
Provenance
File details
Details for the file pydeps-1.1.1.win32.exe
.
File metadata
- Download URL: pydeps-1.1.1.win32.exe
- Upload date:
- Size: 261.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 947bb25c1e4c9e0f0f58f52e30d0034db04c47d349a92a495ccc88a2f6ba1525 |
|
MD5 | b01c59a6e451832cfe9e0cc940be38e6 |
|
BLAKE2b-256 | 9ec0dafd1b5e2e654311e52c0200aa177d760ad324c5e25ea2ef9078890e2012 |
Provenance
File details
Details for the file pydeps-1.1.1-py2-none-any.whl
.
File metadata
- Download URL: pydeps-1.1.1-py2-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c66d8a2427f5234ff82abc0a0f48f187c8c3836d5f5996c31f03e988718d94ed |
|
MD5 | e8ff72f97d0ecaaeefc7fa73a56ede79 |
|
BLAKE2b-256 | b43a03e8c488b34c89515e6262013ca2473982168f301c9af917539e78337c96 |