From 46e04a47e5a77cdea98ac7c74ea275e194f26f3b Mon Sep 17 00:00:00 2001 From: Xenepix Date: Sun, 26 Nov 2023 16:32:45 +0100 Subject: [PATCH] docs(reference): setup mkdocstring --- django_napse/core/models/accounts/space.py | 4 ++++ docs/sources/reference/space.md | 6 ++++++ mkdocs.yml | 13 ++++++++++--- requirements/development.txt | 6 ++++-- 4 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 docs/sources/reference/space.md diff --git a/django_napse/core/models/accounts/space.py b/django_napse/core/models/accounts/space.py index ad49169b..63e5177b 100644 --- a/django_napse/core/models/accounts/space.py +++ b/django_napse/core/models/accounts/space.py @@ -11,6 +11,8 @@ class NapseSpace(models.Model): + """Categorize and manage money.""" + name = models.CharField(max_length=200) uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True) description = models.TextField() @@ -26,6 +28,7 @@ def __str__(self): return f"SPACE: {self.name}" def info(self, verbose=True, beacon=""): + """Info documentation.""" string = "" string += f"{beacon}Space ({self.pk=}):\n" string += f"{beacon}Args:\n" @@ -41,6 +44,7 @@ def info(self, verbose=True, beacon=""): @property def testing(self): + """Testing property documentation.""" return self.exchange_account.testing @property diff --git a/docs/sources/reference/space.md b/docs/sources/reference/space.md new file mode 100644 index 00000000..4ef606d2 --- /dev/null +++ b/docs/sources/reference/space.md @@ -0,0 +1,6 @@ +::: django_napse.core.models.NapseSpace + options: + members: + - info + - testing + show_source: false \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index e797f1da..98156a0b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -65,6 +65,11 @@ plugins: html_report_dir: htmlcov # default - neoteroi.mkdocsoad: use_pymdownx: true + - mkdocstrings: + default_handler: python + handlers: + python: + paths: [src] markdown_extensions: - toc: @@ -113,8 +118,10 @@ nav: - "sources/guides/exchange_account.md" - "sources/guides/space.md" - "sources/guides/fleet.md" + - Reference: + - "sources/reference/space.md" - API: "api.md" - - Development: coverage.md - - Contributing: + - Development: - Contributing: "contributing.md" - - Security: "SECURITY.md" \ No newline at end of file + - Security: "SECURITY.md" + - Coverage: coverage.md \ No newline at end of file diff --git a/requirements/development.txt b/requirements/development.txt index 5fa927f0..be4adaa4 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -13,10 +13,12 @@ platformdirs==3.11.0 # https://github.com/platformdirs/platformdi # Documentation mkdocs-material==9.4.10 # https://github.com/squidfunk/mkdocs-material pygments==2.17.1 # https://github.com/pygments/pygments -mkdocs-plugin-inline-svg==0.1.0 # https://pypi.org/project/mkdocs-plugin-inline-svg/ +mkdocs-plugin-inline-svg==0.1.0 # https://pypi.org/project/mkdocs-plugin-inline-svg mkdocs-coverage==1.0.0 # https://github.com/pawamoy/mkdocs-coverage neoteroi-mkdocs==1.0.4 # https://github.com/Neoteroi/mkdocs-plugins -drf-spectacular==0.26.5 # https://github.com/tfranzel/drf-spectacular/ +drf-spectacular==0.26.5 # https://github.com/tfranzel/drf-spectacular +mkdocstrings==0.24.0 # https://github.com/mkdocstrings/mkdocstrings +mkdocstrings-python==1.7.5 # https://github.com/mkdocstrings/python # pyyaml==6.0.1 # https://github.com/yaml/pyyaml # uritemplate==4.1.1 # https://github.com/python-hyper/uritemplate # pymdown-extensions==10.5.1 # https://github.com/facelessuser/pymdown-extensions