|
| 1 | +"""Sphinx configuration for the compute-geometry documentation.""" |
| 2 | + |
| 3 | +import os |
| 4 | +import sys |
| 5 | +from datetime import date |
| 6 | + |
| 7 | +# Make the cgeom package importable for autodoc. |
| 8 | +sys.path.insert(0, os.path.abspath("..")) |
| 9 | + |
| 10 | +# -- Project information ----------------------------------------------------- |
| 11 | + |
| 12 | +project = "compute-geometry" |
| 13 | +author = "Kleyton da Costa" |
| 14 | +copyright = f"{date.today().year}, {author}" |
| 15 | + |
| 16 | +# Pull the version straight from the installed package metadata. |
| 17 | +try: |
| 18 | + from importlib.metadata import version as _version |
| 19 | + |
| 20 | + release = _version("compute-geometry") |
| 21 | +except Exception: # pragma: no cover - fallback when not installed |
| 22 | + release = "0.1.2" |
| 23 | +version = ".".join(release.split(".")[:2]) |
| 24 | + |
| 25 | +# -- General configuration --------------------------------------------------- |
| 26 | + |
| 27 | +extensions = [ |
| 28 | + "sphinx.ext.autodoc", |
| 29 | + "sphinx.ext.autosummary", |
| 30 | + "sphinx.ext.napoleon", |
| 31 | + "sphinx.ext.viewcode", |
| 32 | + "sphinx.ext.intersphinx", |
| 33 | + "myst_parser", |
| 34 | + "sphinx_copybutton", |
| 35 | +] |
| 36 | + |
| 37 | +templates_path = ["_templates"] |
| 38 | +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
| 39 | + |
| 40 | +source_suffix = { |
| 41 | + ".rst": "restructuredtext", |
| 42 | + ".md": "markdown", |
| 43 | +} |
| 44 | + |
| 45 | +# -- Autodoc / autosummary --------------------------------------------------- |
| 46 | + |
| 47 | +autosummary_generate = True |
| 48 | +autodoc_member_order = "bysource" |
| 49 | +autodoc_typehints = "description" |
| 50 | +autodoc_default_options = { |
| 51 | + "members": True, |
| 52 | + "undoc-members": True, |
| 53 | + "show-inheritance": True, |
| 54 | +} |
| 55 | + |
| 56 | +# Napoleon understands the Google-style docstrings used across the codebase. |
| 57 | +napoleon_google_docstring = True |
| 58 | +napoleon_numpy_docstring = False |
| 59 | +napoleon_include_init_with_doc = True |
| 60 | +napoleon_use_rtype = False |
| 61 | + |
| 62 | +# -- Intersphinx ------------------------------------------------------------- |
| 63 | + |
| 64 | +intersphinx_mapping = { |
| 65 | + "python": ("https://docs.python.org/3", None), |
| 66 | + "numpy": ("https://numpy.org/doc/stable/", None), |
| 67 | + "matplotlib": ("https://matplotlib.org/stable/", None), |
| 68 | +} |
| 69 | + |
| 70 | +# -- MyST -------------------------------------------------------------------- |
| 71 | + |
| 72 | +myst_enable_extensions = [ |
| 73 | + "colon_fence", |
| 74 | + "deflist", |
| 75 | + "smartquotes", |
| 76 | +] |
| 77 | +myst_heading_anchors = 3 |
| 78 | + |
| 79 | +# -- HTML output (Furo theme) ------------------------------------------------ |
| 80 | + |
| 81 | +html_theme = "furo" |
| 82 | +html_title = "compute-geometry" |
| 83 | +html_static_path = ["_static"] |
| 84 | +html_logo = "../public/logo.svg" |
| 85 | +html_favicon = "../public/logo.svg" |
| 86 | + |
| 87 | +html_theme_options = { |
| 88 | + "sidebar_hide_name": True, |
| 89 | + "navigation_with_keys": True, |
| 90 | + "source_repository": "https://github.com/kleyt0n/compute-geometry", |
| 91 | + "source_branch": "main", |
| 92 | + "source_directory": "docs/", |
| 93 | + "light_css_variables": { |
| 94 | + "color-brand-primary": "#0466c8", |
| 95 | + "color-brand-content": "#0466c8", |
| 96 | + }, |
| 97 | + "dark_css_variables": { |
| 98 | + "color-brand-primary": "#5b8def", |
| 99 | + "color-brand-content": "#5b8def", |
| 100 | + }, |
| 101 | +} |
0 commit comments