Skip to content

Commit

Permalink
Merge pull request #869 from emabre/feature/695
Browse files Browse the repository at this point in the history
Autogenerate class/module diagrams for Python
  • Loading branch information
mgovers authored Jan 13, 2025
2 parents 8534402 + 639cef3 commit 19a96e2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ build:
os: "ubuntu-22.04"
tools:
python: "3.11"
apt_packages:
- graphviz
jobs:
post_install:
# Build package with doc requirements from pyproject.optional-dependencies
Expand All @@ -21,6 +23,11 @@ build:
- find power_grid_model_c/power_grid_model_c/include -name *.h -exec sed -i -r "s/PGM_API //g" {} \;
# build doxygen for C header
- cd docs/doxygen && doxygen && cd ../..
# build class and package diagrams
- pyreverse --no-standalone -o dot src/power_grid_model
- ccomps -x classes.dot | dot -Grankdir=LR -Nfontsize=13 -Efontsize=13 | gvpack -m100 -array_l1 | neato -n2 -Tsvg -o docs/_static/classes.svg
- dot packages.dot -Grankdir=TD -Nfontsize=13 -Efontsize=13 -Tsvg -o docs/_static/packages.svg
- rm packages.dot classes.dot
# download support
- wget -P docs/release_and_support https://github.com/PowerGridModel/.github/raw/main/RELEASE.md
- wget -P docs/release_and_support https://github.com/PowerGridModel/.github/raw/main/SUPPORT.md
Expand Down
37 changes: 37 additions & 0 deletions docs/advanced_documentation/python-wrapper-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!--
SPDX-FileCopyrightText: Contributors to the Power Grid Model project <[email protected]>
SPDX-License-Identifier: MPL-2.0
-->

# Design of the Python Wrapper Package

The structure of the `power_grid_model` Python package is shown here below by means of the corresponding class and package diagrams.

## Class Graph Diagram

This is the class diagram of the `power_grid_model` package.

```{note}
Only classes that have connections to other classes are shown in this diagram.
```

```{raw} html
<div style="overflow-x: auto; white-space: nowrap;">
<img src="../_static/classes.svg" style="max-width: none;" alt="Classe diagram">
</div>.
```

## Package Graph Diagram

This is the package diagram of the `power_grid_model` package.

```{note}
Only modules that import (or are impored by) other modules are shown in this diagram.
```

```{raw} html
<div style="overflow-x: auto; white-space: nowrap;">
<img src="../_static/packages.svg" style="max-width: none;" alt="Package diagram">
</div>.
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ advanced_documentation/native-data-interface
advanced_documentation/build-guide
advanced_documentation/c-api
advanced_documentation/core-design
advanced_documentation/python-wrapper-design
```
```{toctree}
:caption: "Contribution"
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ doc = [
"numpydoc",
"pandas",
"gitpython",
"pylint",
]

[project.urls]
Expand Down

0 comments on commit 19a96e2

Please sign in to comment.