Welcome to py_deps’s documentation!¶
Contents:
About py-dep¶
The py-dep
provides parsing the dependencies of Python packages
and generating the metadata for graph.
The graph data is for Graphviz, blockdiag, Linkdraw, etc.
Requirements¶
- Python 2.7 over or Python 3.4 over
- pip 1.5.6 or 6.1.1 over
- wheel 0.24.0 over
Features¶
- Generating Linkdraw data.
Basic usage¶
py-deps provides parsing the Python deps and generating graph data.
Initialize¶
$ python
>>> from py_deps import Package
>>> pkg = Package('py-deps')
Pretty print¶
>>> print(pkg.draw())
py-deps -> [setuptools, pip, wheel]
setuptools -> [certifi, wincertstore, setuptools[ssl], pytest]
pip -> [pytest, virtualenv, scripttest, mock, pytest,
virtualenv, scripttest, mock]
wheel -> [ed25519ll, keyring, argparse, pyxdg, jsonschema,
pytest, coverage, pytest-cov]
>>>
Linkdraw¶
>>> import json
>>> json.loads(pkg.draw('linkdraw'))
{"nodes": [
{"color": "", "r": "6", "link": "", "name": "py-deps"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "setuptools"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "pip"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "wheel"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "certifi"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "wincertstore"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "setuptools____ssl"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "pytest"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "virtualenv"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "scripttest"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "mock"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "ed25519ll"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "keyring"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "argparse"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "pyxdg"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "jsonschema"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "coverage"},
{"color": "#5F9EA0", "r": "6", "link": "", "name": "pytest-cov"}],
"lines": [
{"source": "py-deps", "link": "", "target": "setuptools",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "py-deps", "link": "", "target": "pip",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "py-deps", "link": "", "target": "wheel",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "setuptools", "link": "", "target": "certifi",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "setuptools", "link": "", "target": "wincertstore",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "setuptools", "link": "", "target": "setuptools____ssl",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "setuptools", "link": "", "target": "pytest",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "pytest",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "virtualenv",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "scripttest",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "mock",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "pytest",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "virtualenv",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "scripttest",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "pip", "link": "", "target": "mock",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "ed25519ll",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "keyring",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "argparse",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "pyxdg",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "jsonschema",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "pytest",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "coverage",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"},
{"source": "wheel", "link": "", "target": "pytest-cov",
"descr": "\u2192", "width": "1", "color": "#5F9EA0"}],
"descr": "py-deps dependencies", "time": "2015-05-05T23:52:53.198572"}
References¶
py_deps.deps module.
-
class
py_deps.deps.
Node
(name, version=None, url=None)¶ Bases:
object
Node object class.
-
add_targets
(nodes)¶ Add targets.
-
add_test_targets
(nodes)¶ Add test targets.
-
remove_targets
(*nodes)¶ Remove targets.
-
-
class
py_deps.deps.
Package
(name)¶ Bases:
object
Package class.
-
cleanup
(alldir=False)¶ Cleanup temporary build directory.
Parameters: alldir (bool) – Remove all temporary directories. (default: False) Return type: None
-
draw
(draw_type=None)¶ Generate drawing data.
Parameters: draw_type (str) – [dot|blockdiag|linkdraw]
-
-
class
py_deps.deps.
Target
(nodename, specs, extras=False)¶ Bases:
py_deps.deps.Node
Target objects.
-
add_targets
(nodes)¶ Add targets.
-
add_test_targets
(nodes)¶ Add test targets.
-
remove_targets
(*nodes)¶ Remove targets.
-
py_deps.graph module.
-
class
py_deps.graph.
Linkdraw
(chain_data)¶ Bases:
object
Linkdraw data generate class.
-
generate_data
()¶ Generate Linkdraw data.
-
generate_lines
()¶ Generate lines data.
-
generate_nodes
()¶ Generate nodes data.
-
-
py_deps.graph.
pretty_print
(chain_data)¶ Pretty print on terminal.
Parameters: chain_data (list) – List of deps.Node
-
py_deps.graph.
router
(chain_data, draw_type=None)¶ Routing drawing tool.