|
3 | 3 | # For the full list of built-in configuration values, see the documentation: |
4 | 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html |
5 | 5 |
|
6 | | -# -- Path setup -------------------------------------------------------------- |
7 | | -import os |
8 | | -import sys |
| 6 | +import importlib.metadata |
9 | 7 | import time |
10 | 8 |
|
11 | | -# Put the repository root on sys.path so autodoc imports the local package. |
12 | | -DOCS_DIR = os.path.abspath(os.path.dirname(__file__)) |
13 | | -REPO_ROOT = os.path.abspath(os.path.join(DOCS_DIR, "..")) |
14 | | -sys.path.insert(0, REPO_ROOT) |
15 | | - |
16 | 9 | # -- Project information ----------------------------------------------------- |
| 10 | +# Change these for your project. |
17 | 11 | project = "CCPBioSim-Python-Template" |
18 | 12 | copyright_first_year = "2025" |
19 | 13 | copyright_owners = "CCPBioSim" |
|
27 | 21 | ) |
28 | 22 | copyright = f"{copyright_year_string}, {copyright_owners}. All rights reserved" |
29 | 23 |
|
30 | | -version = "" |
31 | | -release = "" |
| 24 | +# Read from the installed package, so it matches the release. |
| 25 | +release = importlib.metadata.version("example_package") |
32 | 26 |
|
33 | 27 | # -- General configuration --------------------------------------------------- |
34 | 28 | extensions = [ |
35 | | - "sphinx.ext.autosummary", |
36 | | - "sphinx.ext.autodoc", |
37 | 29 | "sphinx.ext.mathjax", |
38 | 30 | "sphinx.ext.viewcode", |
39 | 31 | "sphinx.ext.napoleon", |
40 | 32 | "sphinx.ext.intersphinx", |
41 | 33 | "sphinx.ext.extlinks", |
42 | | - "nbsphinx", |
43 | | - "sphinx_copybutton", |
| 34 | + "autoapi.extension", |
44 | 35 | ] |
45 | 36 |
|
46 | | -# Autosummary (API stubs) |
47 | | -autosummary_generate = True |
48 | | - |
49 | 37 | # Napoleon: Google-style docstrings |
50 | 38 | napoleon_google_docstring = True |
51 | 39 | napoleon_numpy_docstring = False |
52 | 40 | napoleon_use_param = True |
53 | 41 | napoleon_use_rtype = True |
54 | 42 | napoleon_use_ivar = True |
55 | 43 |
|
| 44 | +# API reference generated from the source by sphinx-autoapi |
| 45 | +autoapi_dirs = ["../../example_package"] |
| 46 | +autoapi_root = "reference" |
| 47 | +autoapi_add_toctree_entry = False |
| 48 | +autoapi_member_order = "groupwise" |
| 49 | +# Include the __init__ docstring, where the constructor arguments are documented |
| 50 | +autoapi_python_class_content = "both" |
| 51 | +autoapi_options = [ |
| 52 | + "members", |
| 53 | + "undoc-members", |
| 54 | + "show-inheritance", |
| 55 | + "show-module-summary", |
| 56 | +] |
| 57 | + |
| 58 | +# Show type hints in the parameter list rather than the signature |
| 59 | +autodoc_typehints = "description" |
| 60 | +add_module_names = False |
| 61 | +python_maximum_signature_line_length = 88 |
| 62 | + |
56 | 63 | templates_path = ["_templates"] |
57 | 64 |
|
58 | 65 | source_suffix = ".rst" |
|
62 | 69 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
63 | 70 |
|
64 | 71 | # -- Options for HTML output ------------------------------------------------- |
65 | | -html_theme = "furo" |
| 72 | +# The shared CCPBioSim theme. Change github_repo to your repository's name. |
| 73 | +html_theme = "ccpbiosim_sphinx_theme" |
| 74 | +html_context = {"github_repo": "Python-Template"} |
66 | 75 | html_static_path = ["_static"] |
0 commit comments