Files
HCFS/hcfs-python/docs/conf.py
2025-07-30 09:34:16 +10:00

243 lines
6.8 KiB
Python

"""
Configuration file for Sphinx documentation builder.
This file only contains a selection of the most common options. For a full
list see the documentation:
https://www.sphinx-doc.org/en/master/usage/configuration.html
"""
import os
import sys
from datetime import datetime
# Add the project root and source directories to the path
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, os.path.abspath('../hcfs'))
# -- Project information -----------------------------------------------------
project = 'HCFS'
copyright = f'{datetime.now().year}, HCFS Development Team'
author = 'HCFS Development Team'
# The full version, including alpha/beta/rc tags
release = '2.0.0'
version = '2.0.0'
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# extensions.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
'sphinx.ext.todo',
'sphinx.ext.mathjax',
'sphinx_autodoc_typehints',
'sphinx_copybutton',
'myst_parser',
'sphinxcontrib.openapi',
'sphinxcontrib.httpdomain',
'sphinx_design',
'autoapi.extension',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# The suffix(es) of source filenames.
source_suffix = {
'.rst': None,
'.md': 'myst_parser',
}
# The master toctree document.
master_doc = 'index'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages.
html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme
html_theme_options = {
'collapse_navigation': False,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False,
'logo_only': False,
'display_version': True,
'prev_next_buttons_location': 'bottom',
'style_external_links': True,
}
# Add any paths that contain custom static files (such as style sheets) here
html_static_path = ['_static']
# Custom CSS files
html_css_files = [
'custom.css',
]
# The name of the Pygments (syntax highlighting) style to use.
html_pygments_style = 'sphinx'
# Logo and favicon
html_logo = '_static/logo.png'
html_favicon = '_static/favicon.ico'
# -- Extension configuration -------------------------------------------------
# Napoleon settings for Google/NumPy style docstrings
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = False
napoleon_use_admonition_for_notes = False
napoleon_use_admonition_for_references = False
napoleon_use_ivar = False
napoleon_use_param = True
napoleon_use_rtype = True
napoleon_preprocess_types = False
napoleon_type_aliases = None
napoleon_attr_annotations = True
# Autodoc settings
autodoc_default_options = {
'members': True,
'member-order': 'bysource',
'special-members': '__init__',
'undoc-members': True,
'exclude-members': '__weakref__'
}
autodoc_typehints = 'description'
autodoc_typehints_description_target = 'documented'
# AutoAPI settings for automatic API documentation
autoapi_type = 'python'
autoapi_dirs = ['../hcfs']
autoapi_root = 'api'
autoapi_add_toctree_entry = False
autoapi_generate_api_docs = True
autoapi_python_class_content = 'both'
autoapi_member_order = 'bysource'
autoapi_options = [
'members',
'undoc-members',
'show-inheritance',
'show-module-summary',
'special-members',
'imported-members',
]
# Intersphinx mapping for cross-references
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'numpy': ('https://numpy.org/doc/stable/', None),
'scipy': ('https://docs.scipy.org/doc/scipy/', None),
'scikit-learn': ('https://scikit-learn.org/stable/', None),
'pandas': ('https://pandas.pydata.org/docs/', None),
'fastapi': ('https://fastapi.tiangolo.com/', None),
'pydantic': ('https://docs.pydantic.dev/latest/', None),
'httpx': ('https://www.python-httpx.org/', None),
}
# TODO extension
todo_include_todos = True
# MyST parser settings
myst_enable_extensions = [
"colon_fence",
"deflist",
"dollarmath",
"fieldlist",
"html_admonition",
"html_image",
"linkify",
"replacements",
"smartquotes",
"strikethrough",
"substitution",
"tasklist",
]
# Copy button settings
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
copybutton_prompt_is_regexp = True
# -- Options for LaTeX output ------------------------------------------------
latex_engine = 'pdflatex'
latex_elements = {
'papersize': 'letterpaper',
'pointsize': '10pt',
'preamble': r'''
\usepackage{charter}
\usepackage[defaultsans]{lato}
\usepackage{inconsolata}
''',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'HCFS.tex', 'HCFS Documentation',
'HCFS Development Team', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'hcfs', 'HCFS Documentation',
[author], 1)
]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'HCFS', 'HCFS Documentation',
author, 'HCFS', 'Context-Aware Hierarchical Context File System.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
epub_author = author
epub_publisher = author
epub_copyright = copyright
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# -- Custom configuration ----------------------------------------------------
def setup(app):
"""Custom setup function."""
app.add_css_file('custom.css')
# Add custom directives or configurations here
pass
# API Documentation settings
openapi_spec_path = '../openapi.yaml'