Skip to content

Commit

Permalink
✨ build documentation references on Read the Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
enryH committed Sep 3, 2024
1 parent 1ff999a commit f3a7d06
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import acore

# Add any Sphinx extension module names here, as strings. They can be
Expand Down Expand Up @@ -160,4 +161,33 @@
]


# -- Setup for sphinx-apidoc -------------------------------------------------

# sphinx-apidoc needs to be called manually if Sphinx is running there.
# https://github.com/readthedocs/readthedocs.org/issues/1139

if os.environ.get("READTHEDOCS") == "True":
from pathlib import Path

PROJECT_ROOT = Path(__file__).parent.parent
PACKAGE_ROOT = PROJECT_ROOT / "acore"

def run_apidoc(_):
from sphinx.ext import apidoc

apidoc.main(
[
"--force",
"--implicit-namespaces",
"--module-first",
"--separate",
"-o",
str(PROJECT_ROOT / "docs" / "reference"),
str(PACKAGE_ROOT),
str(PACKAGE_ROOT / "*.c"),
str(PACKAGE_ROOT / "*.so"),
]
)

def setup(app):
app.connect("builder-inited", run_apidoc)

0 comments on commit f3a7d06

Please sign in to comment.