oct
Loading...
Searching...
No Matches
conf.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# docs/_sphinx/conf.py
4
5"""
6Purpose
7-------
8Sphinx configuration for the OCT project documentation build.
9
10Responsibilities
11----------------
12- Define project metadata (name, version, author, copyright).
13- Register Sphinx extensions (MyST, Mermaid, autodoc, Napoleon, etc.).
14- Configure HTML theme, static paths, and template paths.
15
16Diagnostics
17-----------
18Domain: DOCS
19L2: documentation build configuration
20L3: build configuration details
21L4: deep tracing
22
23Contracts
24---------
25- This file is consumed by ``sphinx-build`` and ``oct docs --sphinx``.
26- Paths in ``templates_path`` and ``html_static_path`` are relative to
27 the confdir (``docs/_sphinx/``).
28"""
29# OCT-LINT: disable-file=dbg_import reason="Sphinx executes conf.py itself; it is build configuration, not an Option C module, and must not import the project runtime (operator-ruled 2026-09-27, same form as secret_scanner.py)"
30# OCT-LINT: disable-file=dbg_usage reason="Sphinx executes conf.py itself; it is build configuration, not an Option C module (operator-ruled 2026-09-27)"
31
32# Configuration file for the Sphinx documentation builder.
33#
34# Generated by: oct docs --sphinx / oct scaffold
35# Lives in: docs/_sphinx/conf.py
36
37import os
38import sys
39
40# Allow autodoc to import project modules
41# Path: _sphinx/ → docs/ → project_root/
42sys.path.insert(0, os.path.abspath('../..'))
43
44# -- Project information -----------------------------------------------------
45
46project = 'oct'
47copyright = '2026, Option C Dev Team'
48author = 'Option C Dev Team'
49release = '0.9.1'
50
51# -- General configuration ---------------------------------------------------
52
53extensions = [
54 'myst_parser',
55 'sphinxcontrib.mermaid',
56 'sphinx.ext.autosectionlabel',
57 'sphinx_copybutton',
58 'sphinx.ext.autodoc',
59 'sphinx.ext.autosummary',
60 'sphinx.ext.viewcode',
61 'sphinx.ext.inheritance_diagram',
62 'sphinx.ext.napoleon',
63]
64
65# Prefix section labels with document name to avoid duplicates across modules
66autosectionlabel_prefix_document = True
67
68myst_enable_extensions = [
69 'colon_fence',
70 'attrs_inline',
71 'smartquotes',
72 'replacements',
73]
74
75myst_heading_anchors = 3
76
77# Convert ```mermaid fenced blocks to Sphinx mermaid directives
78myst_fence_as_directive = {"mermaid"}
79
80# templates_path and html_static_path are relative to confdir (docs/_sphinx/)
81templates_path = ['../_templates']
82exclude_patterns = ['html', 'doctrees', 'old', 'code_reviews', 'sphinx_docs',
83 'source', '_sphinx', '_templates', '_autosummary',
84 'doxygen_output', 'doxygen_work_dir',
85 'Thumbs.db', '.DS_Store']
86
87# Suppress noisy warnings from markdown files
88suppress_warnings = ['myst.xref_missing', 'myst.header', 'docutils',
89 'autosectionlabel.*']
90
91# -- Autodoc configuration --------------------------------------------------
92
93autosummary_generate = True
94
95autodoc_default_options = {
96 'members': True,
97 'undoc-members': True,
98 'show-inheritance': True,
99 # Document each re-exported name once, where it is defined; otherwise an
100 # unqualified reference has two targets (operator-ruled 2026-09-27).
101 'ignore-module-all': True,
102}
103
104# Option C docstrings carry a numpy-style "Attributes" section. Napoleon's
105# default turns it into `.. attribute::` directives, which are index
106# entries; autodoc's undoc-members then documents the same dataclass field
107# again ("duplicate object description ... use :no-index:"). Rendering the
108# section as :ivar: fields leaves autodoc's entry as the only indexed one.
109# (operator-ruled 2026-09-27)
110napoleon_use_ivar = True
111
112# -- Options for HTML output -------------------------------------------------
113
114html_theme = 'sphinx_book_theme'
115html_static_path = ['../_static']
116html_css_files = ['custom.css']
117html_logo = '../_static/Option_C_logo.svg'
118
119html_theme_options = {
120 "repository_url": "https://github.com/available/soon",
121 "use_repository_button": True,
122 "use_fullscreen_button": True,
123 "use_download_button": True,
124 "home_page_in_toc": True,
125 "show_toc_level": 2,
126}