Skip to main content

DoxypypyPlantUML

TLDR; if you are fed up with doxypypy screwing up your inlined PlantUML diagrams then this is probably what you are looking for.

PlantUML is great for incorporating UML diagrams in your software documentation. If you have hybrid projects (containing for example both C and Python) you might rely on Doxygen for generating some nice documentation. Typically, you can do this by installing doxypypy, which transforms your Python docstrings into Doxygen tagged documentation.

So far so good.

Unfortunately, doxypypy performs some transformations when it sees things like colons (it thinks it's an argument?); these are typically used in docstrings for documenting for example function arguments. This can become problematic when you are inlining PlantUML diagram code. For an example refer to "Bug Example" below.

One way to fix this is to fix it in doxypypy. Unfortunately the code is really hard to understand and unmaintained. This package, doxypypyplantuml, implements a simple and effective solution.

How It Works

You simply provide it with the original file and the output of doxypypy. Doxypypyplantuml will look for the @startuml and @enduml tags (or \startuml and \enduml). Everything in between these tags is part of the PlantUML Doxygen block. It will replace everything in the doxypypy output between these tags by exactly the same thing that was in the original file, only prefixing it with a # and a correct amount of indentation.

Installation

To install it simply use pip as usual, e.g.:

python3 -m pip install doxypypyplantuml

Using it in your project

The steps are almost identical to the steps for setting up doxypypy. Just follow the steps there, but there is one difference: You need to pipe the output of doxypypy to doxypypyplantuml and provide the original input.

The py_filter file (for Unix-like operating systems) should therefore become:

#!/bin/bash
doxypypy -a -c $1 | doxypypyplantuml $1

Development notes

Before committing always first run ./run.py and check the output.

I've followed the instructions on https://packaging.python.org/en/latest/tutorials/packaging-projects/ to create this package.

To build and upload the package simply run ./run.py --upload.

Bug example

The following input, containing a PlantUML diagram in the class docstring, results in the incorrect doxypypy output that's below it (it's invalid PlantUML syntax).

class SomeStateMachine:
    """The state machine for bla bla.

    It comprehends the following state machine:

    @startuml
    State_A: On Entry / Transmit something
    State_A: During / Retry every second

    State_B: On Entry / Transmit GET_CCP_VERSION CRO
    State_B: During / Retry every second

    [*] -d-> State_A
    State_A -d-> State_B: connect()

    @enduml
    """
    def __init__(self, msg_handler: CcpMessageHandler):
        pass
## @brief The state machine for bla bla.
#
#    It comprehends the following state machine:
#
#    @startuml
# 	State_A	On Entry / Transmit something
# 	State_A	During / Retry every second
#
# 	State_B	On Entry / Transmit GET_CCP_VERSION CRO
# 	State_B	During / Retry every second
#
#    [*] -d-> State_A
#    State_A -d-> State_B: connect()
#
#    @enduml
#
class SomeStateMachine:
    def __init__(self, msg_handler: CcpMessageHandler):
        pass

Release files for doxypypyplantuml 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doxypypyplantuml 1.0.0
File Size Uploaded
doxypypyplantuml-1.0.0.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for doxypypyplantuml 1.0.0
File Interpreter ABI Platform
doxypypyplantuml-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / doxypypyplantuml-1.0.0.tar.gz

Download URL doxypypyplantuml-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c2d49a66b35688753d2dd1689abe51ec166266fc819be9c1a1ca0f5636ee24fc
BLAKE2b-256 checksum
How to use checksums
745d3c32b462722c251c4eae1ef37995fcaef11c17e93c667ab832cca7ff249e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release files / doxypypyplantuml-1.0.0-py3-none-any.whl

Download URL doxypypyplantuml-1.0.0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3df3d2412b5535226cb641928b47666907d53e74c59cf443801261a0f4d26132
BLAKE2b-256 checksum
How to use checksums
f5fc53e9491df8aad4eeceb416b2d580558f22f39ef0c24efa6109ca956febac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page