Skip to content

Commit

Permalink
docs: introduces api reference docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobCoffee authored Jun 26, 2023
2 parents 0f6d4e3 + 93f98b5 commit b941934
Show file tree
Hide file tree
Showing 39 changed files with 522 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,4 @@ coverage.*
setup.py
!/niapi/lib/
!/tests/**/lib/
!/docs/**/lib/
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ repos:
rev: "1.5.1"
hooks:
- id: poetry-check
- id: poetry-lock
args: ["--no-update"]
# - id: poetry-lock
# args: ["--no-update"]
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v2.3.0
hooks:
Expand Down
8 changes: 8 additions & 0 deletions docs/api/asgi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
====
asgi
====

Entry point for ASGI-compatible application.

.. automodule:: niapi.asgi
:members:
16 changes: 16 additions & 0 deletions docs/api/cli.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
===
cli
===

Command line interface for the application.

CLI Usage
---------

.. click:: niapi.cli:run_all_app
:prog: run_all_app
:nested: full

.. click:: niapi.cli:run_app
:prog: app
:nested: full
8 changes: 8 additions & 0 deletions docs/api/domain/calculator/controllers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
===========
controllers
===========

Controllers for the application calculator.

.. automodule:: niapi.domain.calculator.controllers
:members:
11 changes: 11 additions & 0 deletions docs/api/domain/calculator/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==========
calculator
==========

.. toctree::
:titlesonly:
:caption: NIAPI Calculator Domain API Reference
:glob:
:hidden:

*
8 changes: 8 additions & 0 deletions docs/api/domain/calculator/schema.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
======
schema
======

Schema for the application calculator.

.. automodule:: niapi.domain.calculator.schema
:members:
8 changes: 8 additions & 0 deletions docs/api/domain/init.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==================
Domain Initializer
==================

Initializes the domain module.

.. automodule:: niapi.domain.__init__
:members:
8 changes: 8 additions & 0 deletions docs/api/domain/system/controllers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
===========
controllers
===========

Controllers for the application system.

.. automodule:: niapi.domain.system.controllers
:members:
11 changes: 11 additions & 0 deletions docs/api/domain/system/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
======
system
======

.. toctree::
:titlesonly:
:caption: NIAPI System Domain API Reference
:glob:
:hidden:

*
8 changes: 8 additions & 0 deletions docs/api/domain/urls.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
====
urls
====

URL patterns for the NIAPI app.

.. automodule:: niapi.domain.urls
:members:
8 changes: 8 additions & 0 deletions docs/api/domain/web/controllers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
===========
controllers
===========

Controllers for the application web interface.

.. automodule:: niapi.domain.web.controllers.web
:members:
11 changes: 11 additions & 0 deletions docs/api/domain/web/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
===
web
===

.. toctree::
:titlesonly:
:caption: NIAPI Web Domain API Reference
:glob:
:hidden:

*
30 changes: 29 additions & 1 deletion docs/api/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
=============
API Reference
=============

.. toctree::
:titlesonly:
:maxdepth: 1
:caption: API Reference Documentation
:glob:
:hidden:

asgi
cli
metadata
utils

.. toctree::
:titlesonly:
:caption: Domain API Reference
:glob:
:hidden:

domain/*
domain/web/index
domain/system/index
domain/calculator/index

.. toctree::
:titlesonly:
:caption: Library API Reference
:glob:
:hidden:

lib/*
lib/log/index
8 changes: 8 additions & 0 deletions docs/api/lib/cors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
====
cors
====

CORS config

.. automodule:: niapi.lib.cors
:members:
8 changes: 8 additions & 0 deletions docs/api/lib/exceptions.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==========
exceptions
==========

Application exceptions

.. automodule:: niapi.lib.exceptions
:members:
9 changes: 9 additions & 0 deletions docs/api/lib/log/controller.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
==========
controller
==========

Log config for the controllers

.. automodule:: niapi.lib.log.controller
:members:
:noindex:
11 changes: 11 additions & 0 deletions docs/api/lib/log/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
=======
logging
=======

.. toctree::
:titlesonly:
:caption: Library Logging API Reference Documentation
:glob:
:hidden:

*
9 changes: 9 additions & 0 deletions docs/api/lib/log/init.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
====
init
====

Log initialization

.. automodule:: niapi.lib.log.__init__
:members:
:noindex:
9 changes: 9 additions & 0 deletions docs/api/lib/log/utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
=====
utils
=====

Log utils

.. automodule:: niapi.lib.log.utils
:members:
:noindex:
8 changes: 8 additions & 0 deletions docs/api/lib/openapi.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=======
openapi
=======

OpenAPI config

.. automodule:: niapi.lib.openapi
:members:
10 changes: 10 additions & 0 deletions docs/api/lib/schema.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
======
schema
======

Schema for the API and application.


.. automodule:: niapi.lib.schema
:members:
:noindex:
8 changes: 8 additions & 0 deletions docs/api/lib/serialization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=============
serialization
=============

Application serialization utilities.

.. automodule:: niapi.lib.serialization
:members:
8 changes: 8 additions & 0 deletions docs/api/lib/settings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
========
settings
========

Application settings

.. automodule:: niapi.lib.settings
:members:
8 changes: 8 additions & 0 deletions docs/api/lib/static_files.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
============
static files
============

Static file config

.. automodule:: niapi.lib.static_files
:members:
8 changes: 8 additions & 0 deletions docs/api/lib/template.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
==========
template
==========

Template engine config

.. automodule:: niapi.lib.template
:members:
8 changes: 8 additions & 0 deletions docs/api/metadata.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
========
metadata
========

Metadata for the application.

.. automodule:: niapi.metadata
:members:
8 changes: 8 additions & 0 deletions docs/api/utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=====
utils
=====

Utilities for the application.

.. automodule:: niapi.utils
:members:
44 changes: 37 additions & 7 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@

import importlib.metadata
import os
import sys
from pathlib import Path

from dotenv import load_dotenv

from niapi.metadata import __project__ as project

# -- Environmental Data ------------------------------------------------------
path = Path("..").resolve()
tls_verify = False
sys.path.insert(0, path.as_posix())
load_dotenv()

# -- Project information -----------------------------------------------------
Expand Down Expand Up @@ -41,7 +46,8 @@
"click": ("https://click.palletsprojects.com/en/8.1.x/", None),
"structlog": ("https://www.structlog.org/en/stable/", None),
"opentelemetry": ("https://opentelemetry-python.readthedocs.io/en/latest/", None),
"litestar": ("https://docs.litestar.dev/2", None),
"litestar": ("https://docs.litestar.dev/2/", None),
"msgspec": ("https://jcristharif.com/msgspec/", None),
}

napoleon_google_docstring = True
Expand All @@ -51,13 +57,37 @@
napoleon_use_admonition_for_references = False
napoleon_attr_annotations = True

autoclass_content = "class"
autodoc_class_signature = "separated"
autodoc_default_options = {"special-members": "__init__", "show-inheritance": True, "members": True}
autodoc_member_order = "bysource"
autodoc_typehints_format = "short"
autoclass_content = "both"
autodoc_default_options = {
"members": True,
"member-order": "bysource",
"special-members": "__init__",
"exclude-members": "__weakref__",
"show-inheritance": True,
"class-signature": "separated",
"typehints-format": "short",
}

nitpicky = False # This is too much of a headache right now
nitpick_ignore = []
nitpick_ignore_regex = []

with Path("nitpick-exceptions").open() as file:
for line in file:
if line.strip() == "" or line.startswith("#"):
continue
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore.append((dtype, target))

with Path("nitpick-exceptions-regex").open() as file:
for line in file:
if line.strip() == "" or line.startswith("#"):
continue
dtype, target = line.split(None, 1)
target = target.strip()
nitpick_ignore_regex.append((dtype, target))

nitpicky = True
autosectionlabel_prefix_document = True
suppress_warnings = [
"autosectionlabel.*",
Expand Down
Loading

0 comments on commit b941934

Please sign in to comment.