|
| 1 | +# Configuration file for the Sphinx documentation builder. |
| 2 | + |
| 3 | +import os |
| 4 | +import sys |
| 5 | + |
| 6 | +# Add the source directory to the path |
| 7 | +sys.path.insert(0, os.path.abspath("../../src")) |
| 8 | + |
| 9 | +# -- Project information -------------------------- |
| 10 | + |
| 11 | +project = "ezmsg.event" |
| 12 | +copyright = "2024, ezmsg Contributors" |
| 13 | +author = "ezmsg Contributors" |
| 14 | + |
| 15 | +# The version is managed by hatch-vcs and stored in __version__.py |
| 16 | +try: |
| 17 | + from ezmsg.event.__version__ import version as release |
| 18 | +except ImportError: |
| 19 | + release = "unknown" |
| 20 | + |
| 21 | +# For display purposes, extract the base version without git commit info |
| 22 | +version = release.split("+")[0] if release != "unknown" else release |
| 23 | + |
| 24 | +# -- General configuration -------------------------- |
| 25 | + |
| 26 | +extensions = [ |
| 27 | + "sphinx.ext.autodoc", |
| 28 | + "sphinx.ext.autosummary", |
| 29 | + "sphinx.ext.napoleon", |
| 30 | + "sphinx.ext.intersphinx", |
| 31 | + "sphinx.ext.viewcode", |
| 32 | + "sphinx.ext.duration", |
| 33 | + "sphinx_copybutton", |
| 34 | + "myst_parser", # For markdown files |
| 35 | +] |
| 36 | + |
| 37 | +templates_path = ["_templates"] |
| 38 | +source_suffix = { |
| 39 | + ".rst": "restructuredtext", |
| 40 | + ".md": "markdown", |
| 41 | +} |
| 42 | +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
| 43 | + |
| 44 | +# The toctree master document |
| 45 | +master_doc = "index" |
| 46 | + |
| 47 | +# -- Autodoc configuration ------------------------------ |
| 48 | + |
| 49 | +# Auto-generate API docs |
| 50 | +autosummary_generate = True |
| 51 | +autosummary_imported_members = False |
| 52 | +autodoc_typehints = "description" |
| 53 | +autodoc_member_order = "bysource" |
| 54 | +autodoc_typehints_format = "short" |
| 55 | +python_use_unqualified_type_names = True |
| 56 | +autodoc_default_options = { |
| 57 | + "members": True, |
| 58 | + "member-order": "bysource", |
| 59 | + "special-members": "__init__", |
| 60 | + "undoc-members": True, |
| 61 | + "show-inheritance": True, |
| 62 | +} |
| 63 | + |
| 64 | +# Don't show the full module path in the docs |
| 65 | +add_module_names = False |
| 66 | + |
| 67 | +# -- Intersphinx configuration -------------------------- |
| 68 | + |
| 69 | +intersphinx_mapping = { |
| 70 | + "python": ("https://docs.python.org/3/", None), |
| 71 | + "numpy": ("https://numpy.org/doc/stable/", None), |
| 72 | + "ezmsg": ("https://www.ezmsg.org/ezmsg/", None), |
| 73 | + "ezmsg.sigproc": ("https://www.ezmsg.org/ezmsg-sigproc/", None), |
| 74 | +} |
| 75 | +intersphinx_disabled_domains = ["std"] |
| 76 | + |
| 77 | +# -- Options for HTML output ----------------------------- |
| 78 | + |
| 79 | +html_theme = "pydata_sphinx_theme" |
| 80 | +html_static_path = ["_static"] |
| 81 | + |
| 82 | +# Set the base URL for the documentation |
| 83 | +html_baseurl = "https://www.ezmsg.org/ezmsg-event/" |
| 84 | + |
| 85 | +html_theme_options = { |
| 86 | + "logo": { |
| 87 | + "text": f"ezmsg.event {version}", |
| 88 | + "link": "https://ezmsg.org", # Link back to main site |
| 89 | + }, |
| 90 | + "header_links_before_dropdown": 4, |
| 91 | + "navbar_start": ["navbar-logo"], |
| 92 | + "navbar_end": ["theme-switcher", "navbar-icon-links"], |
| 93 | + "icon_links": [ |
| 94 | + { |
| 95 | + "name": "GitHub", |
| 96 | + "url": "https://github.com/ezmsg-org/ezmsg-event", |
| 97 | + "icon": "fa-brands fa-github", |
| 98 | + }, |
| 99 | + { |
| 100 | + "name": "ezmsg.org", |
| 101 | + "url": "https://www.ezmsg.org", |
| 102 | + "icon": "fa-solid fa-house", |
| 103 | + }, |
| 104 | + ], |
| 105 | +} |
| 106 | + |
| 107 | +# Timestamp is inserted at every page bottom in this strftime format. |
| 108 | +html_last_updated_fmt = "%Y-%m-%d" |
| 109 | + |
| 110 | +# -- Options for linkcode ----------------------------- |
| 111 | + |
| 112 | +branch = "main" |
| 113 | +code_url = f"https://github.com/ezmsg-org/ezmsg-event/blob/{branch}/" |
| 114 | + |
| 115 | + |
| 116 | +def linkcode_resolve(domain, info): |
| 117 | + if domain != "py": |
| 118 | + return None |
| 119 | + if not info["module"]: |
| 120 | + return None |
| 121 | + filename = info["module"].replace(".", "/") |
| 122 | + return f"{code_url}src/{filename}.py" |
0 commit comments