|
| 1 | +from instrumentman import __version__ |
| 2 | + |
| 3 | + |
| 4 | +project = "I-man" |
| 5 | +copyright = "2025, MrClock8163" |
| 6 | +author = "MrClock8163" |
| 7 | + |
| 8 | +version = ".".join(__version__.split(".")[0:2]) |
| 9 | +release = __version__ |
| 10 | + |
| 11 | +extensions = [ |
| 12 | + "sphinx.ext.autodoc", |
| 13 | + "sphinx.ext.intersphinx", |
| 14 | + "sphinx.ext.doctest", |
| 15 | + "sphinx.ext.linkcode", |
| 16 | + "sphinx.ext.napoleon", |
| 17 | + "sphinxarg.ext", |
| 18 | + "notfound.extension", |
| 19 | + "sphinx_last_updated_by_git", |
| 20 | + "sphinx_immaterial", |
| 21 | + "sphinx_mdinclude" |
| 22 | +] |
| 23 | + |
| 24 | +intersphinx_mapping = { |
| 25 | + "python": ("https://docs.python.org/3", None), |
| 26 | + "geocompy": ("https://geocompy.readthedocs.io/latest/", None) |
| 27 | +} |
| 28 | + |
| 29 | +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] |
| 30 | +templates_path = ["_templates"] |
| 31 | +sphinx_immaterial_icon_path = ["_templates/.icons"] |
| 32 | +sphinx_immaterial_override_generic_admonitions = False |
| 33 | +sphinx_immaterial_override_builtin_admonitions = False |
| 34 | +sphinx_immaterial_override_version_directives = False |
| 35 | +sphinx_immaterial_generate_extra_admonitions = False |
| 36 | + |
| 37 | +add_module_names = False |
| 38 | + |
| 39 | +html_static_path = ["_static"] |
| 40 | +html_css_files = [ |
| 41 | + "css/custom.css", |
| 42 | +] |
| 43 | +# html_logo = "_static/logo.svg" |
| 44 | +# html_favicon = "_static/favicon.svg" |
| 45 | +html_last_updated_fmt = "%d %b %Y" |
| 46 | +html_copy_source = False |
| 47 | +html_scaled_image_link = False |
| 48 | +html_use_opensearch = "https://instrumentman.readthedocs.io" |
| 49 | +html_theme = 'sphinx_immaterial' |
| 50 | +html_theme_options = { |
| 51 | + "icon": { |
| 52 | + "repo": "fontawesome/brands/github", |
| 53 | + "edit": "material/file-edit-outline", |
| 54 | + }, |
| 55 | + "features": [ |
| 56 | + "content.code.copy", |
| 57 | + "navigation.top", |
| 58 | + "navigation.sections", |
| 59 | + "navigation.expand", |
| 60 | + "navigation.path", |
| 61 | + "toc.follow" |
| 62 | + ], |
| 63 | + "site_url": "https://instrumentman.readthedocs.io", |
| 64 | + "repo_url": "https://github.com/MrClock8163/Instrumentman", |
| 65 | + "repo_name": "Instrumentman", |
| 66 | + "palette": [ |
| 67 | + { |
| 68 | + "media": "(prefers-color-scheme)", |
| 69 | + "toggle": { |
| 70 | + "icon": "material/brightness-auto", |
| 71 | + "name": "Switch to light mode", |
| 72 | + }, |
| 73 | + }, |
| 74 | + { |
| 75 | + "media": "(prefers-color-scheme: light)", |
| 76 | + "scheme": "default", |
| 77 | + "primary": "custom", |
| 78 | + "accent": "custom", |
| 79 | + "toggle": { |
| 80 | + "icon": "material/weather-sunny", |
| 81 | + "name": "Switch to dark mode", |
| 82 | + }, |
| 83 | + }, |
| 84 | + { |
| 85 | + "media": "(prefers-color-scheme: dark)", |
| 86 | + "scheme": "slate", |
| 87 | + "primary": "custom", |
| 88 | + "accent": "custom", |
| 89 | + "toggle": { |
| 90 | + "icon": "material/weather-night", |
| 91 | + "name": "Switch to system preference", |
| 92 | + }, |
| 93 | + }, |
| 94 | + ], |
| 95 | + "social": [ |
| 96 | + { |
| 97 | + "icon": "fontawesome/brands/github", |
| 98 | + "link": "https://github.com/MrClock8163/Instrumentman", |
| 99 | + "name": "Project on GitHub" |
| 100 | + }, |
| 101 | + { |
| 102 | + "icon": "fontawesome/brands/python", |
| 103 | + "link": "https://pypi.org/project/instrumentman/", |
| 104 | + } |
| 105 | + ] |
| 106 | +} |
| 107 | + |
| 108 | +# Immaterial toc adjustments |
| 109 | +object_description_options = [ |
| 110 | + ( |
| 111 | + "py:.*", |
| 112 | + { |
| 113 | + "include_fields_in_toc": False, |
| 114 | + "include_rubrics_in_toc": False |
| 115 | + } |
| 116 | + ), |
| 117 | + ( |
| 118 | + "py:parameter", |
| 119 | + { |
| 120 | + "include_in_toc": False |
| 121 | + } |
| 122 | + ) |
| 123 | +] |
| 124 | + |
| 125 | +autodoc_default_options = { |
| 126 | + "member-order": "groupwise", |
| 127 | + "no-show-inheritance": True, |
| 128 | + "members": True, |
| 129 | + "undoc-members": True |
| 130 | +} |
| 131 | +autoclass_content = "both" |
| 132 | + |
| 133 | +napoleon_use_admonition_for_notes = True |
| 134 | +napoleon_preprocess_types = True |
| 135 | +napoleon_google_docstring = False |
| 136 | +napoleon_use_ivar = True |
| 137 | +napoleon_type_aliases: dict[str, str] = {} |
| 138 | + |
| 139 | +python_display_short_literal_types = True |
| 140 | +python_type_aliases: dict[str, str] = {} |
| 141 | + |
| 142 | +# Error checking |
| 143 | +nitpicky = True |
| 144 | +nitpick_ignore = { |
| 145 | + ("py:class", "optional"), |
| 146 | + ("py:class", "datetime"), |
| 147 | + ("py:param", "_E"), |
| 148 | + ("py:param", "_T"), |
| 149 | + ("py:class", "_T"), |
| 150 | + ("py:param", "_P"), |
| 151 | + ("py:class", "_P") |
| 152 | +} |
| 153 | +nitpick_ignore_regex = { |
| 154 | + ("py:obj", r"[a-zA-Z]{3}\.\w+") |
| 155 | +} |
| 156 | + |
| 157 | + |
| 158 | +# GitHub source linking |
| 159 | +def linkcode_resolve(domain: str, info: dict[str, str]) -> str | None: |
| 160 | + if domain != 'py': |
| 161 | + return None |
| 162 | + if not info['module']: |
| 163 | + return None |
| 164 | + filename = info['module'].replace('.', '/') |
| 165 | + return ( |
| 166 | + "https://github.com/MrClock8163/" |
| 167 | + f"geocompy/tree/main/src/{filename:s}.py" |
| 168 | + ) |
| 169 | + |
| 170 | + |
| 171 | +latex_documents = [ |
| 172 | + ( |
| 173 | + "latexindex", "instrumentman.tex", |
| 174 | + "Instrumentman documentation", "MrClock8163", |
| 175 | + "manual", False |
| 176 | + ) |
| 177 | +] |
| 178 | +# latex_logo = "geocompy_logo.png" |
| 179 | +latex_elements = { |
| 180 | + "papersize": "a4paper", |
| 181 | + "extraclassoptions": "oneside", |
| 182 | + "makeindex": ( |
| 183 | + r"\usepackage[columns=1]{idxlayout}" |
| 184 | + r"\makeindex" |
| 185 | + ), |
| 186 | + "preamble": ( |
| 187 | + r"\usepackage{titlesec}" |
| 188 | + r"\newcommand{\sectionbreak}{\clearpage}" |
| 189 | + r"\setcounter{tocdepth}{2}" |
| 190 | + r"\definecolor{vadded}{RGB}{54,145,0}" |
| 191 | + r"\definecolor{vchanged}{RGB}{228,160,1}" |
| 192 | + r"\definecolor{vremoved}{RGB}{204,0,0}" |
| 193 | + r"\newcommand{\DUroleversionmodified}[1]{\textit{\textbf{#1}}}" |
| 194 | + r"\newcommand{\DUroleadded}{\color{vadded}}" |
| 195 | + r"\newcommand{\DUrolechanged}{\color{vchanged}}" |
| 196 | + r"\newcommand{\DUroleremoved}{\color{vremoved}}" |
| 197 | + r"\newcommand{\DUroledeprecated}{\color{vremoved}}" |
| 198 | + ), |
| 199 | + "fontpkg": ( |
| 200 | + r"\usepackage{lmodern}" |
| 201 | + r"\renewcommand*{\familydefault}{\rmdefault}" |
| 202 | + r"\renewcommand{\ttdefault}{lmtt}" |
| 203 | + ), |
| 204 | + # https://www.sphinx-doc.org/en/master/latex.html#additional-css-like-sphinxsetup-keys |
| 205 | + "sphinxsetup": ", ".join( |
| 206 | + map( |
| 207 | + lambda p: f"div.{p}_border-radius=3pt", |
| 208 | + ( |
| 209 | + "attention", |
| 210 | + "caution", |
| 211 | + "danger", |
| 212 | + "error", |
| 213 | + "hint", |
| 214 | + "important", |
| 215 | + "note", |
| 216 | + "tip", |
| 217 | + "warning", |
| 218 | + "seealso" |
| 219 | + ) |
| 220 | + ) |
| 221 | + ) |
| 222 | +} |
0 commit comments