Registry / devops / sphinxcontrib-plantuml

sphinxcontrib-plantuml

JSON →
library0.31pypypiunverified

sphinxcontrib-plantuml is a Sphinx extension that enables the embedding of PlantUML diagrams directly into reStructuredText or Markdown documentation. It translates PlantUML text blocks into image files (PNG, SVG, PDF) during the Sphinx build process. The current version is 0.31, and the project maintains a fairly active release cadence, with multiple updates in recent years.

pip install sphinxcontrib-plantuml
INSTALL
IMPORT
SIG · SPHINXCONTRIB-PLAN
S
sphinxcontrib-plantuml
devopspythonv0.31
Install
6.9s avg
Import
Disk
94MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.31 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 92.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 6.9s · import 0.000s · 93MB
94MB installed
● package 94MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sphinxcontrib.plantuml
extensions = ['sphinxcontrib.plantuml']
To enable the extension, add 'sphinxcontrib.plantuml' to the 'extensions' list in your Sphinx conf.py file.

To quickly get started, first, create a Sphinx project. Then, modify your `conf.py` to include `sphinxcontrib.plantuml` in your `extensions` list. Crucially, ensure that the PlantUML Java executable is either in your system's PATH or explicitly configured using the `plantuml` variable in `conf.py`. Finally, embed PlantUML code directly into your reStructuredText files using the `.. uml::` directive.

# conf.py import os project = 'My Project' copyright = '2026, Your Name' extensions = [ 'sphinxcontrib.plantuml', ] # Configure PlantUML executable path (essential if not in PATH) # Replace '/path/to/plantuml.jar' with the actual path. # If 'plantuml' command is in your system PATH, this line can be omitted. # plantuml = 'java -jar /path/to/plantuml.jar' # Optional: Set output format (default is 'png' for HTML) # plantuml_output_format = 'svg_img' # index.rst (or a new .rst file) # Add the following to your .rst file: # .. uml:: # @startuml # Alice -> Bob: Hello # Bob -> Alice: Hi! # @enduml # To build the documentation: # sphinx-build -b html . _build/html
Debug
Known issues
breakingThe `sphinxcontrib-plantuml` extension itself is merely a Python wrapper for Sphinx. It *requires* PlantUML (the Java application) and a Java Runtime Environment (JRE) to be installed separately on the system where Sphinx builds are performed. Without these, diagrams cannot be rendered, leading to build failures or 'unknown directive' errors.
fix
Install PlantUML and a compatible JRE. Download `plantuml.jar` from the official PlantUML website and install Java (e.g., OpenJDK). Ensure the `java` command and `plantuml.jar` are accessible.
affects: All versions
gotchaIf the `plantuml` command is not in your system's PATH, you must explicitly configure its full command in `conf.py`. Failing to do so will result in Sphinx being unable to find and execute PlantUML.
fix
Add `plantuml = 'java -jar /path/to/plantuml.jar'` to your `conf.py`, replacing `/path/to/plantuml.jar` with the actual location of the PlantUML executable JAR file.
affects: All versions
gotchaPlantUML can sometimes silently fall back to generating PNG images, even when another format (like SVG) is requested, for example, when certain diagram types (e.g., ditaa) are included. This silent fallback can cause unexpected encoding errors in `sphinxcontrib-plantuml` if it expects a specific output format.
fix
Explicitly define the expected output format using `plantuml_output_format` and ensure your PlantUML code is compatible with the desired output. Check PlantUML's own error logs for issues with diagram generation.
affects: 0.20.1 and potentially other versions
gotchaFor HTML output, the default `plantuml_output_format` is `png`. If using SVG, `svg_obj` (embedding with `<object/>`) might lead to scaling issues in some browsers. For better responsiveness, `svg_img` (embedding with `<img/>`) is often preferred. For LaTeX/PDF output, `png` quality can be poor; `svg_pdf` (requires `sphinxcontrib-svg2pdfconverter` or similar) or `eps_pdf` (requires `epstopdf`) is recommended.
fix
Set `plantuml_output_format = 'svg_img'` in `conf.py` for responsive SVG in HTML. For high-quality PDF, configure `plantuml_latex_output_format = 'pdf'` (which uses `svg_pdf` or `eps_pdf` if converters are available) and ensure necessary converters like `sphinxcontrib-svg2pdfconverter` or `epstopdf` are installed.
affects: All versions
deprecatedOlder versions of `sphinxcontrib-plantuml` had compatibility issues with newer Sphinx 4.x releases and Python 3.13 due to internal API changes in Sphinx and Python's `inspect` module.
fix
Always use the latest stable version of `sphinxcontrib-plantuml` (0.31 or newer) to ensure compatibility with recent Sphinx and Python releases. Upgrade `pip install --upgrade sphinxcontrib-plantuml`.
affects: < 0.28 (Sphinx 4.x issues), potentially older versions for Python 3.13
Upgrade
Version history
0.31latest on PyPI · released Sep 3, 2025
Audit
Dependencies
PlantUMLrequiredRequired Java application for rendering diagrams. Must be installed separately and accessible via PATH or configured in conf.py.
Java Runtime Environment (JRE)requiredRequired to run PlantUML. Must be installed separately.
Agent activity
2 hits · last 30 days
node
2
Resources