Feature uml diagram - #186
Conversation
|
Thanks @PXY-no I'm concerned the diagram is too large to comprehend. I wonder what other formatting options we have to control the level of detail. I also wonder if it might be better to create separate diagrams for the different parts / modules of the codebase. Let me know what you think. Also I see there is a conflic with the poetry lock file that needs to be fixed. |
|
I agree that the current diagram is quite large and can be difficult to comprehend. The diagram currently includes the entire smart_control codebase, including *_test.py files. I wasn't sure whether we should include the test classes or exclude them from the diagram, as both approaches could make sense depending on what we want the diagram to represent. Instead of splitting it into separate diagrams and potentially losing relationships between modules, I found mkdocs-panzoom, which adds pan and zoom functionality to the diagram. This allows us to keep the architecture in a single diagram while making it easier to navigate. I've attached some screenshots showing the normal view, zoomed-in view and horizontal panning. I also tried removing the test classes from the UML diagram to see how this affects readability. What do you think?
|



Fixes #52
This pull request adds a UML class diagram to the main documentation page to help developers understand the project's code architecture.
Key Changes
UML Generation with Mermaid
make umlcommand to generate a.mmdUML class diagram from the Python source code usingpyreverse.mermaidxis used to convert the generated Mermaid diagram into an SVG, which is included indocs/index.md..mmdfile can be rendered directly in MkDocs using Mermaid,pymdownx.snippetsandpymdownx.superfences.CI
Comparison
The following comparison highlights the main differences between the approaches, including the generation workflow, dependencies and integration into MkDocs.
pyreversegenerates the.dotfile, which is then rendered to PNG using Graphviz'sdotcommand. The resulting PNG is embedded in MKDocs. This approach requiresGraphvizto be installed as a system dependency.pyreversegenerates a.mmdfile, which is then converted to SVG usingmermaidx. The resulting SVG is embedded in MKDocs.mermaidxcan be managed as a Poetry dependency.pyreversegenerates a.mmdfile, which is included in a Mermaid code block usingpymdownx.snippetsand rendered by MkDocs withpymdownx.superfences. The resulting diagram is displayed directly in the MkDocs documentation and can be styled using Mermaid or CSS.Screenshots are included below showing the generated UML as a local file and as part of the MkDocs documentation.