| Total Complexity | 1 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 2 | Sphinx config file for Tyrannosaurus. |
||
| 3 | |||
| 4 | Uses several extensions to get API docs and sourcecode. |
||
| 5 | https://www.sphinx-doc.org/en/master/usage/configuration.html |
||
| 6 | """ |
||
| 7 | |||
| 8 | from pathlib import Path |
||
| 9 | |||
| 10 | import tomlkit |
||
| 11 | |||
| 12 | root = Path(__file__).parent.parent.absolute() |
||
| 13 | toml = tomlkit.loads((root / "pyproject.toml").read_text(encoding="utf8")) |
||
| 14 | |||
| 15 | |||
| 16 | def find(key: str) -> str: |
||
| 17 | return str(toml["tool"]["poetry"][key]) |
||
| 18 | |||
| 19 | |||
| 20 | language = None |
||
| 21 | project = find("name") |
||
| 22 | version = find("version") |
||
| 23 | release = find("version") |
||
| 24 | author = ", ".join(find("authors")) |
||
| 25 | copyright = "Copyright (2020)" |
||
| 26 | |||
| 27 | |||
| 28 | extensions = [ |
||
| 29 | "autoapi.extension", |
||
| 30 | "sphinx.ext.napoleon", |
||
| 31 | "sphinx_rtd_theme", |
||
| 32 | "sphinxcontrib.mermaid", |
||
| 33 | ] |
||
| 34 | autoapi_type = "python" |
||
| 35 | autoapi_dirs = [str(root / project)] |
||
| 36 | master_doc = "index" |
||
| 37 | |||
| 38 | |||
| 39 | exclude_patterns = ["_build", "Thumbs.db", ".*", "~*", "*~", "*#"] |
||
| 40 | html_theme = "sphinx_rtd_theme" |
||
| 41 |