|
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 | +import secop_ophyd |
| 7 | + |
6 | 8 | # -- Project information ----------------------------------------------------- |
7 | 9 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information |
8 | 10 |
|
| 11 | +project = "SECoP-Ophyd" |
| 12 | +copyright = "2024, Peter Braun" |
| 13 | +author = "Peter Braun" |
| 14 | +release = secop_ophyd.__version__ |
| 15 | + |
| 16 | +# Clean up version for display - extract just X.Y.Z from version strings like "0.13.9.dev0+gb43270d29.d20251029" |
| 17 | +if "+" in secop_ophyd.__version__: |
| 18 | + # Development version - use short version or "dev" |
| 19 | + release = secop_ophyd.__version__.split("+")[0] |
| 20 | +else: |
| 21 | + release = secop_ophyd.__version__ |
| 22 | + |
| 23 | +version = secop_ophyd.__version__ |
| 24 | + |
| 25 | +language = "en" |
| 26 | + |
| 27 | +source_suffix = ".rst" |
| 28 | +master_doc = "index" |
| 29 | + |
9 | 30 |
|
10 | 31 | # -- General configuration --------------------------------------------------- |
11 | 32 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
12 | 33 |
|
13 | 34 | extensions = [ |
14 | | - "sphinx.ext.autodoc", |
15 | | - "sphinx.ext.autosummary", |
16 | | - "sphinx.ext.githubpages", |
| 35 | + # for diagrams |
| 36 | + "sphinxcontrib.mermaid", |
| 37 | + # Use this for generating API docs |
| 38 | + "autodoc2", |
| 39 | + # For linking to external sphinx documentation |
17 | 40 | "sphinx.ext.intersphinx", |
18 | | - "sphinx.ext.mathjax", |
| 41 | + # Add links to source code in API docs |
19 | 42 | "sphinx.ext.viewcode", |
| 43 | + # Add a copy button to each code block |
| 44 | + "sphinx_copybutton", |
| 45 | + # For the card element |
| 46 | + "sphinx_design", |
| 47 | + # To make .nojekyll |
| 48 | + "sphinx.ext.githubpages", |
| 49 | + # To make the {ipython} directive |
20 | 50 | "IPython.sphinxext.ipython_directive", |
| 51 | + # To syntax highlight "ipython" language code blocks |
21 | 52 | "IPython.sphinxext.ipython_console_highlighting", |
| 53 | + # To embed matplotlib plots generated from code |
22 | 54 | "matplotlib.sphinxext.plot_directive", |
23 | | - "numpydoc", |
24 | | - "sphinx_click", |
25 | | - "sphinx_copybutton", |
| 55 | + # To parse markdown |
26 | 56 | "myst_parser", |
27 | | - "sphinxcontrib.jquery", |
28 | | - "sphinxcontrib.mermaid", |
29 | 57 | ] |
30 | 58 |
|
31 | 59 | templates_path = ["_templates"] |
32 | 60 | exclude_patterns = [] # type: ignore |
33 | 61 |
|
34 | | -# -- Options for HTML output ------------------------------------------------- |
35 | | -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
36 | 62 |
|
37 | | -html_theme = "alabaster" |
38 | | -html_static_path = ["_static"] |
| 63 | +# Which package to load and document |
| 64 | +autodoc2_packages = [{"path": "../../src/secop_ophyd", "auto_mode": True}] |
39 | 65 |
|
| 66 | +# Put them in docs/_api which is git ignored |
| 67 | +autodoc2_output_dir = "_api" |
40 | 68 |
|
41 | | -# Generate the API documentation when building |
42 | | -autosummary_generate = True |
43 | | -numpydoc_show_class_members = False |
44 | 69 |
|
45 | | -source_suffix = ".rst" |
| 70 | +# Don't document private things |
| 71 | +autodoc2_hidden_objects = {"private", "dunder", "inherited"} |
46 | 72 |
|
47 | | -master_doc = "index" |
| 73 | +# MyST parser extensions |
| 74 | +myst_enable_extensions = ["colon_fence", "fieldlist"] |
48 | 75 |
|
49 | | -import secop_ophyd |
| 76 | +# Intersphinx configuration for linking to external documentation |
| 77 | +intersphinx_mapping = { |
| 78 | + "python": ("https://docs.python.org/3", None), |
| 79 | + "bluesky": ("https://blueskyproject.io/bluesky/main", None), |
| 80 | + "ophyd-async": ("https://blueskyproject.io/ophyd-async/main", None), |
| 81 | + "numpy": ("https://numpy.org/devdocs/", None), |
| 82 | +} |
50 | 83 |
|
51 | | -project = "SECoP-Ophyd" |
52 | | -copyright = "2024, Peter Braun" |
53 | | -author = "Peter Braun" |
54 | | -release = secop_ophyd.__version__ |
55 | | -version = secop_ophyd.__version__ |
| 84 | +# Set copy-button to ignore python and bash prompts |
| 85 | +copybutton_prompt_text = ( |
| 86 | + r">>> |\\.\\.\\. |\\$ |In \\[\\d*\\]: | {2,5}\\.\\.\\.: | {5,8}: " |
| 87 | +) |
| 88 | +copybutton_prompt_is_regexp = True |
56 | 89 |
|
57 | | -language = "en" |
| 90 | + |
| 91 | +# -- Options for HTML output ------------------------------------------------- |
| 92 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
| 93 | + |
| 94 | +# Generate the API documentation when building |
| 95 | +autosummary_generate = True |
| 96 | +numpydoc_show_class_members = False |
58 | 97 |
|
59 | 98 |
|
60 | 99 | # -- Options for HTML output ---------------------------------------------- |
61 | 100 |
|
62 | 101 | # The theme to use for HTML and HTML Help pages. See the documentation for |
63 | 102 | # a list of builtin themes. |
64 | 103 | # |
65 | | -html_theme = "sphinx_rtd_theme" |
66 | | -import sphinx_rtd_theme |
| 104 | +html_theme = "pydata_sphinx_theme" |
| 105 | + |
| 106 | +# Theme options for pydata_sphinx_theme |
| 107 | +html_theme_options = { |
| 108 | + "use_edit_page_button": True, |
| 109 | + "github_url": "https://github.com/SampleEnvironment/secop-ophyd", |
| 110 | + "icon_links": [ |
| 111 | + { |
| 112 | + "name": "PyPI", |
| 113 | + "url": "https://pypi.org/project/secop-ophyd", |
| 114 | + "icon": "fas fa-cube", |
| 115 | + }, |
| 116 | + ], |
| 117 | + "external_links": [ |
| 118 | + { |
| 119 | + "name": "SECoP Specification", |
| 120 | + "url": "https://sampleenvironment.github.io/secop-site/", |
| 121 | + }, |
| 122 | + ], |
| 123 | + "navigation_with_keys": False, |
| 124 | + "show_toc_level": 3, |
| 125 | +} |
| 126 | + |
| 127 | +html_logo = "../images/logo.svg" |
| 128 | +html_favicon = "../images/favicon.ico" |
| 129 | + |
| 130 | +html_context = { |
| 131 | + "github_user": "SampleEnvironment", |
| 132 | + "github_repo": "secop-ophyd", |
| 133 | + "github_version": "main", |
| 134 | + "doc_path": "docs", |
| 135 | +} |
| 136 | + |
| 137 | +# If true, "Created using Sphinx" is shown in the HTML footer. |
| 138 | +html_show_sphinx = False |
| 139 | + |
| 140 | +# If true, "(C) Copyright ..." is shown in the HTML footer. |
| 141 | +html_show_copyright = False |
| 142 | + |
| 143 | +# Custom CSS |
| 144 | +html_css_files = ["custom.css"] |
0 commit comments