From c77c9374ec51f7d3962dbd951886bddb03eaa72e Mon Sep 17 00:00:00 2001 From: Cian Hughes Date: Mon, 18 Dec 2023 17:11:14 +0000 Subject: [PATCH] Added UML generation to mkdocs generation --- .gitignore | 2 +- docs/assets/classes.mmd | 14 ++++++++++++ docs/assets/packages.mmd | 49 ++++++++++++++++++++++++++++++++++++++++ docs/configuration.md | 2 +- docs/uml.md | 9 ++++++++ mkdocs.yaml | 9 +++++++- pyproject.toml | 2 ++ scripts/docs.py | 10 ++++---- 8 files changed, 90 insertions(+), 7 deletions(-) create mode 100644 docs/assets/classes.mmd create mode 100644 docs/assets/packages.mmd create mode 100644 docs/uml.md diff --git a/.gitignore b/.gitignore index 61a6b54..6a7a0dc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Byte-compiled / optimized / DLL files -__pycache__/ +*__pycache__/ *.py[cod] *$py.class diff --git a/docs/assets/classes.mmd b/docs/assets/classes.mmd new file mode 100644 index 0000000..5f253d3 --- /dev/null +++ b/docs/assets/classes.mmd @@ -0,0 +1,14 @@ +classDiagram + class Config { + apply_config(config: dict) None + finalise_config(config: dict) None + get_config(config_label: ConfigLabel) dict + update_config(config_label: ConfigLabel) None + } + class IPAddress { + obj : IPv4Address | IPv6Address + } + class Singleton { + } + class SingletonProgress { + } diff --git a/docs/assets/packages.mmd b/docs/assets/packages.mmd new file mode 100644 index 0000000..ed13a1b --- /dev/null +++ b/docs/assets/packages.mmd @@ -0,0 +1,49 @@ +classDiagram + class node_deployer { + } + class __main__ { + } + class autoignition { + } + class cli { + } + class config { + } + class create_disk { + } + class create_img { + } + class debug { + } + class ip_interface { + } + class node_deployer { + } + class utils { + } + __main__ --> config + __main__ --> node_deployer + autoignition --> cli + autoignition --> config + autoignition --> debug + autoignition --> utils + cli --> config + cli --> utils + create_disk --> cli + create_disk --> config + create_disk --> create_img + create_disk --> debug + create_disk --> ip_interface + create_disk --> utils + create_img --> autoignition + create_img --> cli + create_img --> config + create_img --> debug + create_img --> ip_interface + create_img --> utils + debug --> config + node_deployer --> autoignition + node_deployer --> config + node_deployer --> create_disk + node_deployer --> create_img + utils --> config diff --git a/docs/configuration.md b/docs/configuration.md index 8d67b80..c5897c7 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -27,7 +27,7 @@ This configuration keeps all computations local to the machine on which the tool | FUELIGNITION_URL | "http://localhost:3000/fuel-ignition/edit" | str | ## remote -

This configuration allows the use of hosted websites for hte fuel-ignition configurator.

+

This configuration allows the use of hosted websites for the fuel-ignition configurator.

Currently, this configuration is broken/deprecated. It is being kept as it may be be reimplemented in the future as part of a dockerless configuration.

| Variable | Value | Type | diff --git a/docs/uml.md b/docs/uml.md new file mode 100644 index 0000000..3b2a0fa --- /dev/null +++ b/docs/uml.md @@ -0,0 +1,9 @@ +# Packages +```mermaid +{% include "assets/packages.mmd" %} +``` + +# Classes +```mermaid +{% include "assets/classes.mmd" %} +``` \ No newline at end of file diff --git a/mkdocs.yaml b/mkdocs.yaml index fb7a6fb..776d176 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -43,6 +43,7 @@ nav: - debug: src/debug.md - ip_interface: src/ip_interface.md - utils: src/utils.md + - UML: uml.md - Reference: # - FAQ: faq.md # - Troubleshooting: troubleshooting.md @@ -53,7 +54,12 @@ extra: version: provider: mike -# markdown_extensions: +markdown_extensions: + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format # - mkdocs-typer plugins: @@ -64,5 +70,6 @@ plugins: # - material/typeset - search - mkdocstrings + - include-markdown - git-revision-date-localized: enable_creation_date: true \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 278dccc..e79c777 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,9 @@ docker-stubs = {git = "https://github.com/rdozier-work/docker-stubs"} [tool.poetry.group.docs.dependencies] mkdocs = "^1.5.3" mkdocstrings = {extras = ["python"], version = "^0.23.0"} +mkdocs-include-markdown-plugin = "^6.0.4" mkdocs-material = "^9.4.8" +pylint = "^3.0.3" [tool.poetry.scripts] node_deployer = "node_deployer.__main__:main" diff --git a/scripts/docs.py b/scripts/docs.py index 5078201..a237c24 100644 --- a/scripts/docs.py +++ b/scripts/docs.py @@ -1,4 +1,5 @@ -import subprocess +from mkdocs.__main__ import build_command as mkdocs_build +from pylint.pyreverse.main import Run as pyreverse README_FILES = ( @@ -22,11 +23,12 @@ def update_license(): target.write(source.read()) -def create_docs(): - subprocess.run("mkdocs build", shell=True, check=True) +def generate_uml(): + pyreverse(["-o", "mmd", "-d", "docs/assets", "node_deployer"]) def main(): create_readme() update_license() - create_docs() \ No newline at end of file + generate_uml() + mkdocs_build() \ No newline at end of file