11import os
2- import sys
32import warnings
43from datetime import date
54
65from sphinx .deprecation import RemovedInSphinx10Warning
76warnings .filterwarnings ("ignore" , category = RemovedInSphinx10Warning )
87
8+ # The notebooks are executed by a Jupyter kernel whose working directory is the
9+ # notebook's own folder, not this project root. Any relative PYTHONPATH entry (used
10+ # in local builds to point at a sibling module checkout, e.g. ../httk-atomistic/src)
11+ # would fail to resolve there, so normalize PYTHONPATH to absolute paths before the
12+ # kernel subprocess inherits it. Relative entries are resolved against the project
13+ # root (this conf.py's parent directory), which is where such a PYTHONPATH is meant
14+ # to be interpreted. This is a no-op in CI, where the modules are pip-installed and
15+ # PYTHONPATH is unset.
16+ _project_root = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
17+ _pythonpath = os .environ .get ("PYTHONPATH" )
18+ if _pythonpath :
19+ os .environ ["PYTHONPATH" ] = os .pathsep .join (
20+ os .path .join (_project_root , entry ) if entry and not os .path .isabs (entry ) else entry
21+ for entry in _pythonpath .split (os .pathsep )
22+ )
23+
924project = "httk₂"
1025author = "The httk₂ AUTHORS"
1126copyright = f"{ date .today ().year } , { author } "
1227
1328extensions = [
1429 # Core API docs
15- "sphinx.ext.autodoc" , # pull docstrings :contentReference[oaicite:4]{index=4}
16- "sphinx.ext.autosummary" , # API summary tables + stub gen :contentReference[oaicite:5]{index=5}
30+ "sphinx.ext.autodoc" , # pull docstrings
31+ "sphinx.ext.autosummary" , # API summary tables + stub gen
1732 "sphinx.ext.napoleon" , # Google/NumPy docstrings
1833 "sphinx.ext.viewcode" ,
1934 "sphinx.ext.intersphinx" ,
35+ "sphinx.ext.extlinks" ,
2036 "sphinx.ext.mathjax" , # math rendering via MathJax
2137
2238 # Nice-to-haves
2339 "sphinx_autodoc_typehints" ,
2440 "sphinx_copybutton" ,
2541
2642 # Markdown + notebooks
27- "myst_nb" , # .ipynb support :contentReference[oaicite:6]{index=6}
43+ "myst_nb" , # .ipynb support
2844
2945 "autoapi.extension" ,
3046]
6177]
6278myst_heading_anchors = 3
6379
64- # myst-nb config: don't execute notebooks during docs build by default
65- nb_execution_mode = "off"
80+ # Execute the example notebooks as part of the (strict) docs build, so that an
81+ # example that no longer matches the current httk-core / httk-atomistic API fails
82+ # the build instead of silently going stale.
83+ nb_execution_mode = "force"
6684
67- html_theme = "furo" # modern theme :contentReference[oaicite:7]{index=7}
85+ html_theme = "furo"
6886html_theme_options = {
6987 "sidebar_hide_name" : False ,
7088 "navigation_with_keys" : True ,
7189}
7290
73- # Optional: helpful external linking (edit as needed)
91+ # This top-level site now carries a full aggregate API reference built from the
92+ # submodule sources (see autoapi settings below), so cross-module references resolve
93+ # inside this site's own inventory rather than against the per-module subsites. The
94+ # DOCS_BASE_URL plumbing remains for the module directory's "go to the module's own
95+ # subsite" links. The base URL comes from the DOCS_BASE_URL Makefile variable
96+ # (exported as HTTK_DOCS_BASE_URL); the default below keeps bare sphinx invocations
97+ # working.
98+ _docs_base_url = os .environ .get ("HTTK_DOCS_BASE_URL" , "https://docs.httk.org" )
99+
74100intersphinx_mapping = {
75101 "python" : ("https://docs.python.org/3" , None ),
76102}
77103
104+ # Plain "go to the module's docs" links, e.g. {moduledocs}`httk-core`.
105+ extlinks = {"moduledocs" : (f"{ _docs_base_url } /%s/" , "%s documentation" )}
106+
78107autoapi_options = [
79108 "members" ,
80109 "undoc-members" ,
85114autoapi_root = "reference/autoapi"
86115autoapi_ignore = [] # include everything
87116
88- autoapi_follow_symlinks = True
89117autoapi_type = "python"
118+ # The merged httk namespace tree: src/httk/core and src/httk/atomistic are committed
119+ # symlinks into the two submodule checkouts, so AutoAPI parses both distributions as
120+ # a single PEP 420 httk root and cross-module references (httk.atomistic subclassing
121+ # httk.core objects) resolve internally.
90122autoapi_dirs = ["../src/httk" ]
91- autoapi_add_toctree_entry = False
123+ autoapi_add_toctree_entry = True
92124autoapi_keep_files = True
93125autoapi_member_order = "bysource"
94126autoapi_python_class_content = "module" # docstring under class, not merged from __init__
95127autoapi_python_use_implicit_namespaces = True
96- autoapi_ignore = []
97- # autoapi_template_dir = "_templates/autoapi"
128+ autoapi_follow_symlinks = True
129+ autoapi_template_dir = "_templates/autoapi"
98130
99131nitpicky = True
100132nitpick_ignore = [
@@ -116,4 +148,3 @@ def skip_member(app, what, name, obj, skip, options):
116148
117149def setup (sphinx ):
118150 sphinx .connect ('autoapi-skip-member' , skip_member )
119-
0 commit comments