Skip to content

Commit d70928e

Browse files
Merge pull request #2975 from jessica-mitchell/add-plantuml-docs
Add plantuml to docs
2 parents ae7c720 + 4a73806 commit d70928e

File tree

5 files changed

+91
-37
lines changed

5 files changed

+91
-37
lines changed

.readthedocs.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ version: 2
33
build:
44
os: ubuntu-22.04
55
tools:
6-
python: "3.8"
7-
6+
python: "3.10"
7+
apt_packages:
8+
- default-jre-headless
9+
jobs:
10+
pre_install:
11+
- wget "https://github.com/plantuml/plantuml/releases/download/v1.2023.10/plantuml.jar" -O "/tmp/plantuml.jar"
12+
- echo "ee06454723028763dd8280459e8fd8f31fcd85b1ae8d9ab0e32122243c098c3b" "/tmp/plantuml.jar" | sha256sum -c
813
sphinx:
914
builder: html
1015
configuration: doc/htmldoc/conf.py
1116

1217
python:
13-
install:
14-
- requirements: doc/requirements.txt
18+
install:
19+
- requirements: doc/requirements.txt

doc/htmldoc/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"sphinx.ext.intersphinx",
5454
"sphinxcontrib.mermaid",
5555
"sphinx.ext.mathjax",
56+
"sphinxcontrib.plantuml",
5657
"add_button_notebook",
5758
"IPython.sphinxext.ipython_console_highlighting",
5859
"nbsphinx",
@@ -70,6 +71,8 @@
7071
# Add any paths that contain templates here, relative to this directory.
7172
templates_path = ["templates"]
7273

74+
# To run plantuml locally see the user documentation workflow
75+
plantuml = "java -jar /tmp/plantuml.jar"
7376
sphinx_gallery_conf = {
7477
# path to your examples scripts
7578
"examples_dirs": "../../pynest/examples",

doc/htmldoc/developer_space/workflows/documentation_workflow/user_documentation_workflow.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,21 @@ If you use pip, install ``pandoc`` from your platform's package manager (e.g. ap
118118
119119
sudo apt-get install pandoc
120120
121+
.. admonition:: Building plantuml diagrams locally
122+
123+
The plantuml diagrams require additional requirements
124+
to make them work in a local build.
125+
126+
You will need to
127+
128+
- check if you have Java installed. The minimum version needed is Java 8.
129+
(e.g., to install the latest available version on Ubuntu: ``apt install jre-default``)
130+
- Download the `plantuml jar file <https://plantuml.com/download>`_ (Minimum version is 1-2023-10)
131+
- Move the jar file to ``/tmp/plantuml.jar``
132+
133+
- To see if plantuml diagrams render correctly after building the documentation you can take a look
134+
at our :ref:`test_uml`.
135+
121136

122137
Edit and create pages
123138
~~~~~~~~~~~~~~~~~~~~~~
@@ -176,6 +191,7 @@ you will need to build the documentation locally with Sphinx.
176191
177192
sphinx-build . ../_build/html -b html
178193
194+
179195
#. Preview files. They are located in ``doc/_build/html``
180196

181197
.. code-block:: bash
@@ -229,3 +245,8 @@ on Read the Docs, you can set up your own account and link it with your Github a
229245

230246
See `this guide <https://docs.readthedocs.io/en/stable/intro/import-guide.htmli>`_
231247
for more information.
248+
249+
.. toctree::
250+
:hidden:
251+
252+
/testuml

doc/htmldoc/testuml.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.. _test_uml:
2+
3+
Test uml page
4+
-------------
5+
6+
Two diagrams should render on this page.
7+
8+
**Basic example:**
9+
10+
11+
.. uml::
12+
13+
Alice -> Bob: Hi!
14+
Alice <- Bob: How are you?
15+
16+
17+
**C4 example:**
18+
19+
20+
.. uml::
21+
22+
!include <C4/C4_Context>
23+
!define FONTAWESOME https://raw.githubusercontent.com/tupadr3/plantuml-icon-font-sprites/master/font-awesome-5
24+
!include FONTAWESOME/users.puml
25+
Person(user, "C4 fans", "Hello to Sphinx!", $sprite="users")

doc/requirements.txt

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
Image==1.5.30
1+
Image>=1.5.30
22
PyYAML>=4.2b1
3-
RestrictedPython==6.2
4-
cmake==3.26.0
5-
csvkit==1.1.1
3+
RestrictedPython>=6.2
4+
cmake>=3.26.0
5+
csvkit>=1.1.1
66
cython>=0.29.14
7-
docutils==0.19
8-
example==0.1.0
9-
flask==2.3.2
10-
flask_cors==3.0.10
11-
ipykernel==6.22.0
12-
# Pin ipython to a version compatible with Python 3.8, the latest supported by RTD
13-
ipython~=8.11.0
14-
jupyter==1.0.0
15-
matplotlib==3.7.1
16-
mock==5.0.2
17-
nbsphinx==0.9.1
18-
numpy==1.22.0
19-
numpydoc==1.5.0
20-
pandoc==2.3.0
21-
path.py==12.5.0
22-
pydot==1.4.2
23-
pytest==7.3.1
24-
recommonmark==0.7.1
25-
scipy==1.10.1
26-
seaborn==0.12.2
27-
sphinx==6.2.1
28-
sphinx_autobuild==2021.3.14
7+
docutils>=0.19
8+
example>=0.1.0
9+
flask>=2.3.2
10+
flask_cors>=3.0.10
11+
ipykernel>=6.22.0
12+
ipython>=8.11.0
13+
jupyter>=1.0.0
14+
matplotlib>=3.7.1
15+
mock>=5.0.2
16+
nbsphinx>=0.9.1
17+
numpy>=1.22.0
18+
numpydoc>=1.5.0
19+
pandoc>=2.3.0
20+
path.py>=12.5.0
21+
pydot>=1.4.2
22+
pytest>=7.3.1
23+
recommonmark>=0.7.1
24+
scipy>=1.10.1
25+
seaborn>=0.12.2
26+
sphinx>=6.2.1
27+
sphinx_autobuild>=2021.3.14
2928
sphinx-copybutton>=0.5.2
3029
sphinx-notfound-page>=0.8.3
31-
sphinx-design==0.4.1
32-
sphinx-gallery==0.13.0
33-
sphinx-material==0.0.35
34-
sphinxcontrib-mermaid
35-
statsmodels==0.13.5
36-
tqdm==4.65.0
37-
yamllint==1.31.0
30+
sphinx-design>=0.4.1
31+
sphinx-gallery>=0.13.0
32+
sphinx-material>=0.0.35
33+
sphinxcontrib-mermaid>=0.9.2
34+
sphinxcontrib-plantuml>=0.26
35+
statsmodels>=0.13.5
36+
tqdm>=4.65.0
37+
yamllint>=1.31.0

0 commit comments

Comments
 (0)