sphinx-uml#
Overview#
sphinx-uml is a python package that provides:
A Sphinx extension, called using
.. uml, which generates UML diagrams from python modules, just likesphinx-pyreverse.The
pyreverse2command, that extendspyreverseprovided bypylint.
Compared to sphinx-pyreverse,
sphinx-uml outputs enriched dot or
SVG UML diagrams.
responsive to light/black Sphinx themes (as pydata);
if the HTML address is known, the class/attribute/method names can be clicked to browse the corresponding documentation page.
Features#
.. uml directive#
UML diagrams can be obtained by using the .. uml directive.
Example:
.. uml:: example.module.b1
:caption: UML diagram of ``example.module.b1``
:classes:
:packages:
This toy example
shows how to use the .. uml directive in a Sphinx documentation using
sphinx.ext.autodoc and
sphinx.ext.autosummary.
pyreverse2#
The pyreverse2 behaves like the original pyreverse command with two main differences:
--ouput:svganddotare the only supported output formats;--sphinx-html-dircan be used to indicate where is the HTML root directory.
Example: In the example below, we assume that:
the
examplepackage has been installedthe documentation has been built in $HOME/git/sphinx-pyreverse/example/docs/_build/html/
# Generate the UML diagram for each value of x
for x in example example.module example.module.submodule example.module.submodule.c1
do
pyreverse2 \
--sphinx-html-dir $HOME/git/sphinx-uml/example/docs/_build/html/ \
--output svg \
--project $x \
$x
# The previous command outputs {classes,packages}_$o.svg
done
Documentation#
- Installation
- Users
- API
- Packages
- Subpackages
- Submodules
- Module contents
- Packages
- Authors
- History