[General] Add API docs and pydantic for Data Dict

Fix schedule for latex
This commit is contained in:
Nick Touran 2025-12-12 09:40:02 -05:00
parent e474c140ee
commit fb28c6c5c5
11 changed files with 186 additions and 57 deletions

View file

@ -10,9 +10,11 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
import os
import sys
SRC = os.path.abspath("../src")
sys.path.insert(0, SRC)
import datetime
# -- Project information -----------------------------------------------------
@ -39,11 +41,19 @@ extensions = [
"sphinx.ext.imgmath",
"sphinxcontrib.datatemplates",
"sphinxcontrib.mermaid",
"sphinxcontrib.apidoc",
"sphinx.ext.graphviz",
# "sphinx.ext.imgconverter", # SVG to png but rasterizes and bad
"sphinxcontrib.inkscapeconverter", # SVG to pdf without rasterizing
"sphinx_timeline",
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinx_autodoc_typehints",
"sphinx.ext.autosummary",
"sphinxcontrib.autodoc_pydantic",
"sphinx.ext.intersphinx",
"nrsk.schedule.load_schedule",
"nrsk.plant.plant_data_table",
]
# Add any paths that contain templates here, relative to this directory.
@ -84,6 +94,28 @@ html_css_files = [
# https://sphinx-needs.readthedocs.io/en/latest/installation.html#plantuml-support
plantuml = "java -Djava.awt.headless=true -jar /usr/share/plantuml/plantuml.jar"
latex_engine = "xelatex"
latex_elements = {
# "fontenc": r"\usepackage[T2A]{fontenc}",
# "babel": r"\usepackage[english,russian]{babel}",
# "fontpkg": r"""
# \setmainfont{DejaVu Serif}
# \setsansfont{DejaVu Sans}
# \setmonofont{DejaVu Sans Mono}
# """,
"figure_align": "H",
"extraclassoptions": "openany",
#'\makeatletter\@openrightfalse\makeatother'
"extrapackages": r"""
\usepackage{fancyhdr}
\usepackage{etoolbox}
\usepackage{pdflscape}
\usepackage{tabulary}
""",
"preamble": r"""
\AtBeginEnvironment{figure}{\pretocmd{\hyperlink}{\protect}{}{}}
""",
}
# LaTeX document generation options
# doesn't work with sphinx-needs
latex_documents = [
@ -123,6 +155,7 @@ latex_documents = [
# ]
rst_prolog = f"""
.. |inst| replace:: **{company_name}**
.. |project| replace:: **{project_name}**
"""
# will need to move relevant refs somewhere
@ -138,3 +171,29 @@ mermaid_version = "10.6.1"
# Sphinx Needs config
needs_include_needs = True # turn off to hide all needs (e.g. for working docs)
needs_extra_options = ["basis"]
autodoc_typehints = "description"
autodoc_typehints_description_target = "all"
autodoc_default_options = {
"members": True,
"private-members": False,
"undoc-members": True,
"ignore-module-all": True,
}
autodoc_member_order = "bysource"
apidoc_module_dir = SRC
apidoc_module_first = True
apidoc_output_dir = "api"
apidoc_separate_modules = True
autodoc_pydantic_model_show_field_summary = True
autodoc_pydantic_model_show_validator_summary = True
autodoc_pydantic_field_doc_policy = "both"
set_type_checking_flag = True
intersphinx_mapping = {
"pydantic": ("https://docs.pydantic.dev/latest", None),
"python": ("https://docs.python.org/3", None),
}