pydeps - Man Page
Name
pydeps — pydeps Documentation Documentation StatusDownloads
Python module dependency visualization.
This package is primarily intended to be used from the command line through the pydeps command.
Contents
pydeps
- How to install
- Usage
- Example
- Notes
- Configuration files
- Bacon (Scoring)
- Import cycles
- Clustering
- Maximum module depth
- Graph direction
- Collapsing target package
- Intermediate format
- Version history
- Contributing
API documentation
- Module contents
- pydeps.arguments module
- pydeps.cli module
- pydeps.colors module
- pydeps.depgraph module
- pydeps.depgraph2dot module
- pydeps.dot module
- pydeps.dummymodule module
- pydeps.configs module
- pydeps.mf27 module
- pydeps.package_names module
- pydeps.py2depgraph module
- pydeps.pycompat module
- pydeps.pydeps module
- pydeps.pystdlib module
- pydeps.render_context module
- pydeps.target module
- Indices and tables
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]
(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]
--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]
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]
Clustering
Running pydeps pydeps --max-bacon=4 on version 1.8.0 of pydeps gives the following graph: [image]
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]
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]
or, using a smaller max-cluster-size:
shell> pydeps pydeps --max-bacon=4 --cluster --max-cluster-size=3
[image]
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]
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]
..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]
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]
Graph Direction
The direction of the graph can be specified using the --rankdir flag.
Top to bottom (default):
shell> pydeps pydeps --rankdir TB
[image]
Bottom to top:
shell> pydeps pydeps --rankdir BT
[image]
Left to right:
shell> pydeps pydeps --rankdir LR
[image]
Right to left:
shell> pydeps pydeps --rankdir RL
[image]
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]
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.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
Module Contents
Python module dependency visualization. This package installs the pydeps command, and normal usage will be to use it from the command line.
pydeps.arguments Module
- class pydeps.arguments.Argument(*flags, **args)
Bases: object
add_to_parser(parser)
argname()
default()
help()
pytype()
typefn()
typename()
- class pydeps.arguments.Arguments(config_files=None, debug=False, *posargs, parents=None, **kwargs)
Bases: object
add(*flags, **kwargs)
load_config_files()
parse_args(argv)
- write_default_config()
Utility function to create .configs.Config
# XXX: a more general utility to create configs from argparse # would be nice...
- class pydeps.arguments.Namespace(ns)
Bases: object
items()
pydeps.cli Module
command line interface (cli) code.
- pydeps.cli.base_argparser(argv=())
Initial parser that can set values for the rest of the parsing process.
- pydeps.cli.error(*args, **kwargs)
Print an error message and exit.
- pydeps.cli.parse_args(argv=())
Parse command line arguments, and return a dict.
- pydeps.cli.verbose(*args, **kwargs)
the (will become) verbose function
pydeps.colors Module
Color calculations.
- class pydeps.colors.ColorSpace(nodes)
Bases: object
add_to_tree(parts, tree)
color(src)
- pydeps.colors.brightness(r, g, b)
From w3c (range 0..255).
- pydeps.colors.brightnessdiff(a, b)
greater than 125 is good.
- pydeps.colors.colordiff(rgb1, rgb2)
From w3c (greater than 500 is good). (range [0..765])
- pydeps.colors.distinct_hues(count)
Return count hues, equidistantly spaced.
- pydeps.colors.foreground(background, *options)
Find the best foreground color from options based on background color.
- pydeps.colors.frange(start, end, step)
Like range(), but with floats.
- pydeps.colors.name2rgb(hue)
Originally used to calculate color based on module name.
- pydeps.colors.rgb2css(rgb)
Convert rgb to hex.
- pydeps.colors.rgb2eightbit(rgb)
Convert floats in [0..1] to integers in [0..256)
pydeps.depgraph Module
- class pydeps.depgraph.DepGraph(depgraf, types, target, **args)
Bases: object
The dependency graph.
It is the output of pydeps.py2depgraph.py2dep()
add_source(src)
calculate_bacon()
- connect_generations()
Traverse depth-first adding imported_by.
- dissimilarity_metric(a, b)
Return non-zero if references to this module are strange, and should be drawn extra-long. The value defines the length, in rank. This is also good for putting some vertical space between seperate subsystems.
Returns an int between 1 (default) and 4 (highly unrelated).
- exclude_bacon(limit)
Exclude modules that are more than limit hops away from __main__.
exclude_noise()
find_import_cycles()
get_colors(src, colorspace=None)
levelcounts()
- only_filter(paths)
Exclude nodes that have a prefix in paths.
- proximity_metric(a, b)
Return the weight of the dependency from a to b. Higher weights usually have shorter straighter edges. Return 1 if it has normal weight. A value of 4 is usually good for ensuring that a related pair of modules are drawn next to each other.
Returns an int between 1 (unknown, default), and 4 (very related).
- remove_excluded()
Remove all sources marked as excluded.
skip_modules = ['os', 'sys', 'qt', 'time', '__future__', 'types', 're', 'string', 'bdb', 'pdb', '__main__', 'south']
- source_name(name, path=None)
Returns the module name, possibly limited by --max-module-depth.
- sources
dict[module_name] -> Source object
- class pydeps.depgraph.Source(name, path=None, imports=(), exclude=False, args=None)
Bases: object
A node (contained) in the dependency graph.
It contains info about which modules are imported by this source, and which modules import this source.
property degree
get_label(splitlength=0, rmprefix=None)
- property in_degree
Number of incoming arrows.
- is_noise()
Is this module just noise? (too common either at top or bottom of the graph).
- property label
Convert a module name to a formatted node label. This is a default policy - please override.
property module_depth
property name_parts
- property out_degree
Number of outgoing arrows.
property path_parts
- class pydeps.depgraph.imp(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases: Enum
C_BUILTIN = 6
C_EXTENSION = 3
IMP_HOOK = 9
PKG_DIRECTORY = 5
PY_CODERESOURCE = 8
PY_COMPILED = 2
PY_FROZEN = 7
PY_RESOURCE = 4
PY_SOURCE = 1
UNKNOWN = 0
pydeps.depgraph2dot Module
- class pydeps.depgraph2dot.CycleGraphDot(**kw)
Bases: object
render(depgraph, ctx)
- class pydeps.depgraph2dot.PyDepGraphDot(**kw)
Bases: object
render(depgraph, ctx)
pydeps.depgraph2dot.cycles2dot(target, depgraph, **kw)
pydeps.depgraph2dot.dep2dot(target, depgraph, **kw)
pydeps.dot Module
Graphviz interface.
- pydeps.dot.call_graphviz_dot(src, fmt)
Call dot command, and provide helpful error message if we cannot find it.
- pydeps.dot.cmd2args(cmd)
Prepare a command line for execution by Popen.
- pydeps.dot.display_svg(kw, fname)
Try to display the svg file on this platform.
Note that this is also used to display PNG files, despite the name.
- pydeps.dot.dot(src, **kw)
Execute the dot command to create an svg output.
- pydeps.dot.in_wsl()
Are we running under wsl?
- pydeps.dot.is_unicode(s)
Test unicode with py3 support.
- pydeps.dot.pipe(cmd, txt)
Pipe txt into the command cmd and return the output.
- pydeps.dot.to_bytes(s)
Convert an item into bytes.
pydeps.dummymodule Module
- class pydeps.dummymodule.DummyModule(target, **args)
Bases: object
We create a file that imports the module to be investigated.
- legal_module_name(name)
Legal module names are dotted strings where each part is a valid Python identifier. (and not a keyword, and support unicode identifiers in Python3, ..)
print_header(fp)
print_import(fp, module)
- text()
Return the content of the dummy module.
pydeps.dummymodule.fname2modname(fname, package_root)
- pydeps.dummymodule.is_module(directory)
A directory is a module if it contains an __init__.py file.
- pydeps.dummymodule.is_pysource(fname)
A file name is a python source file iff it ends with '.py(w?)' and doesn't start with a dot.
pydeps.dummymodule.python_sources_below(directory, package=True)
pydeps.configs Module
- class pydeps.configs.Config(**kwargs)
Bases: object
- cluster = False
draw external dependencies as separate clusters
- collapse_target_cluster = False
collapse target module (--keep-target-cluster will be ignored)
- config = None
specify config file
- debug = False
turn on all the show and verbose options (mainly for debugging pydeps itself)
- debug_mf = 0
set the ModuleFinder.debug flag to this value
- deps_out = None
write output of dependency analysis to 'file'
- display = None
program to use to display the graph (png or svg file depending on the T parameter)
- dot_out = None
write dot code to 'file'
- exclude = []
input files to skip (e.g. foo.*), multiple file names can be provided
- exclude_exact = []
same as --exclude, except requires the full match. -xx foo.bar will exclude foo.bar, but not foo.bar.blob
- externals = False
create list of direct external dependencies
- find_package = False
tries to automatically find the name of the current package.
- fname = None
filename
- format = 'svg'
output format (svg|png)
- include_missing = False
include modules that are not installed (or can't be found on sys.path)
- keep_target_cluster = False
draw target module as a cluster
- classmethod load(fnames)
Load config from file.
- log = None
set log-level to one of CRITICAL, ERROR, WARNING, INFO, DEBUG, NOTSET.
- max_bacon = 2
exclude nodes that are more than n hops away (default=2, 0 -> infinite)
- max_cluster_size = 0
the maximum number of nodes a dependency can have before the cluster is collapsed to a single node (default=0)
- max_module_depth = 0
coalesce deep modules to at most n levels
- min_cluster_size = 0
the minimum number of nodes a dependency must have before being clustered (default=0)
- no_config = False
disable processing of config files
- no_dot = False
skip dot conversion
- no_output = False
don't create .svg/.png file, implies --no-show (-t/-o will be ignored)
- no_show = False
don't call external program to display graph
- noise_level = 200
exclude sources or sinks with degree greater than noise-level
- only = []
only include modules that start with MODULE_PATH
- output = None
write output to 'file'
- pylib = False
include python std lib modules
- pylib_all = False
include python all std lib modules (incl. C modules)
- rankdir = 'TB'
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)
- reverse = False
draw arrows to (instead of from) imported modules
- rmprefix = []
remove PREFIX from the displayed name of the nodes
set_field(field, value)
- show_cycles = False
show only import cycles
- show_deps = False
show output of dependency analysis
- show_dot = False
show output of dot conversion
- show_raw_deps = False
show output of dependency analysis before removing skips
- start_color = 0
starting value for hue from 0 (red/default) to 360.
update(data)
- verbose = 0
be more verbose (-vv, -vvv for more verbosity)
- version = False
print pydeps version
write_ini()
write_json()
write_toml()
write_yaml()
pydeps.configs.boolval(v)
pydeps.configs.filetype(fname)
pydeps.configs.identity(v)
pydeps.configs.is_string(v)
pydeps.configs.listval(v)
pydeps.configs.load_config(filename)
pydeps.configs.load_ini(filename)
pydeps.configs.load_json(filename)
pydeps.configs.load_toml(filename)
pydeps.configs.load_yaml(filename)
pydeps.mf27 Module
- class pydeps.mf27.ModuleFinder(path=None, debug=0, excludes=None, replace_paths=None)
Bases: ModuleFinder
import_hook(name, caller=None, fromlist=None, level=-1)
load_module(fqname, fp, pathname, file_info)
scan_code(co, m)
- pydeps.mf27.load_pyc(fp, mf=None)
Load a pyc file from a file object.
pydeps.package_names Module
pydeps.package_names.find_package_names()
pydeps.py2depgraph Module
- class pydeps.py2depgraph.Module(name, file=None, path=None)
Bases: object
property shortname
- class pydeps.py2depgraph.MyModuleFinder(syspath, *args, **kwargs)
Bases: ModuleFinder
add_module(fqname)
ensure_fromlist(module, fromlist, recursive=0)
import_hook(name, caller=None, fromlist=None, level=-1)
import_module(partnam, fqname, parent)
load_module(fqname, fp, pathname, suffix_mode_kind)
run_script(pathname)
- class pydeps.py2depgraph.RawDependencies(fname, **kw)
Bases: object
- class pydeps.py2depgraph.imp(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases: IntEnum
C_BUILTIN = 6
C_EXTENSION = 3
IMP_HOOK = 9
PKG_DIRECTORY = 5
PY_CODERESOURCE = 8
PY_COMPILED = 2
PY_FROZEN = 7
PY_RESOURCE = 4
PY_SOURCE = 1
- pydeps.py2depgraph.py2dep(target, **kw) -> DepGraph
"Calculate dependencies for pattern and return a DepGraph.
pydeps.py2depgraph.py2depgraph()
pydeps.pycompat Module
Compatibility imports between py2/py3
pydeps.pydeps Module
cli entrypoints.
- pydeps.pydeps.call_pydeps(file_or_dir, **kwargs)
Programatic entry point for pydeps.
See pydeps.configs.Config class for the available options.
- pydeps.pydeps.depgraph_to_dotsrc(target, dep_graph, **kw)
Convert the dependency graph (DepGraph class) to dot source code.
- pydeps.pydeps.externals(trgt, **kwargs)
Return a list of direct external dependencies of pkgname. Called for the pydeps --externals command.
- pydeps.pydeps.pydeps(**args)
Entry point for the pydeps command.
This function should do all the initial parameter and environment munging before calling _pydeps (so that function has a clean execution path).
pydeps.pystdlib Module
- pydeps.pystdlib.pystdlib()
Return a set of all module-names in the Python standard library.
pydeps.render_context Module
- class pydeps.render_context.Rankdir(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)
Bases: Enum
BOTTOM_TOP = 'BT'
LEFT_RIGHT = 'LR'
RIGHT_LEFT = 'RL'
TOP_BOTTOM = 'TB'
reverse()
- class pydeps.render_context.RenderBuffer(target, reverse=False, rankdir=Rankdir.TOP_BOTTOM, cluster=False, min_cluster_size=0, max_cluster_size=1, keep_target_cluster=False, collapse_target_cluster=False, **kw)
Bases: object
cluster_stats()
graph(**kw)
text()
triage_clusters()
write_node(n, **attrs)
write_rule(a, b, **attrs)
- class pydeps.render_context.RenderContext(out=None, reverse=False, rankdir=Rankdir.TOP_BOTTOM)
Bases: object
- dedent(txt)
Write txt dedented.
- graph(**kw)
Set up a graphviz graph context.
- rule()
Write indented rule.
- text()
Get value of output stream (StringIO).
- write(txt)
Write txt to file and output stream (StringIO).
- write_attributes(attrs)
Write comma separated attribute values (if exists).
- write_node(a, **attrs)
a [a1=x,a2=y];
- write_rule(a, b, **attrs)
a -> b [a1=x,a2=y];
- writeln(txt)
Write txt and add newline.
pydeps.render_context.to_unicode(s)
pydeps.target Module
Abstracting the target for pydeps to work on.
- class pydeps.target.Target(path)
Bases: object
The compilation target.
chdir_work()
- close()
Clean up after ourselves.
get_package_root()
get_parents()
is_dir = False
is_module = False
is_pysource = False
- Index
- Module Index
- Search Page
Author
Copyright
2024 - 2024 Bjorn Pettersen