"""Build the documentation from a static parse of ``src/evomo/``.
AutoAPI reads the source tree instead of importing it, so a docs build needs no
``evomo``, ``evox``, ``evoxc``, torch, GPU or optional-extra install: the same
environment that renders the guide pages can also render the API reference.
"""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
project = "EvoMO"
author = "EvoMO contributors"
copyright = "2026, EvoMO contributors"
release = next(
line.split('"')[1]
for line in (ROOT / "pyproject.toml").read_text(encoding="utf-8").splitlines()
if line.startswith("version = ")
)
version = release
language = "en"
extensions = ["myst_parser", "autoapi.extension", "sphinx.ext.mathjax", "sphinx.ext.napoleon"]
source_suffix = {".md": "markdown", ".rst": "restructuredtext"}
root_doc = "index"
templates_path = ["_templates"]
exclude_patterns = ["_build", "README.md", "CONTEXT.md", "**/CONTEXT.md", "papers", "Thumbs.db", ".DS_Store"]
myst_enable_extensions = ["colon_fence", "dollarmath"]
myst_heading_anchors = 3
autoapi_dirs = [str(ROOT / "src" / "evomo")]
autoapi_python_use_implicit_namespaces = True
autoapi_options = ["members", "undoc-members", "show-inheritance", "show-module-summary", "imported-members"]
autoapi_python_class_content = "both"
autoapi_member_order = "bysource"
autoapi_add_toctree_entry = False
autoapi_keep_files = False
html_theme = "shibuya"
html_title = f"EvoMO {release} documentation"
html_static_path = ["_static", "images"]
html_css_files = ["branding.css", "tables.css"]
html_theme_options = {
"github_url": "https://github.com/EMI-Group/evomo",
"light_logo": "_static/evox_brand_dark.svg",
"dark_logo": "_static/evox_brand_light.svg",
}
suppress_warnings = ["autoapi.python_import_resolution"]
def skip_redundant_members(app, what, name, obj, skip, options):
"""Hide empty algorithm attributes and aliases that collide with modules."""
if what == "attribute" and name.startswith("evomo.algorithms.") and not obj.docstring.strip():
return True
if what == "function" and name in {"evomo.metrics.gd", "evomo.metrics.hv", "evomo.metrics.igd"}:
return True
if what == "data" and name == "evomo.problems.neuroevolution":
return True
return None
def setup(app):
app.connect("autoapi-skip-member", skip_redundant_members)