|
1 | | -"""Sphinx configuration.""" |
| 1 | +"""Sphinx configuration for django-help documentation.""" |
2 | 2 |
|
| 3 | +import sys |
| 4 | +from datetime import datetime |
| 5 | +from pathlib import Path |
| 6 | + |
| 7 | + |
| 8 | +# Add the project root directory to the Python path |
| 9 | +sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) |
| 10 | + |
| 11 | +# Project information |
3 | 12 | project = "django-help" |
4 | 13 | author = "Jack Linke" |
5 | | -copyright = "2024, Jack Linke" |
| 14 | +copyright = f"{datetime.now().year}, {author}" |
| 15 | + |
| 16 | +# General configuration |
6 | 17 | extensions = [ |
7 | 18 | "sphinx.ext.autodoc", |
8 | 19 | "sphinx.ext.napoleon", |
| 20 | + "sphinx.ext.intersphinx", |
| 21 | + "sphinx.ext.viewcode", |
9 | 22 | "sphinx_click", |
10 | 23 | "myst_parser", |
11 | 24 | ] |
12 | | -autodoc_typehints = "description" |
| 25 | + |
| 26 | +# Any paths that contain templates here, relative to this directory. |
| 27 | +templates_path = ["_templates"] |
| 28 | + |
| 29 | +# List of patterns, relative to source directory, that match files and |
| 30 | +# directories to ignore when looking for source files. |
| 31 | +exclude_patterns = ["_build"] |
| 32 | + |
| 33 | +# The name of the Pygments (syntax highlighting) style to use. |
| 34 | +pygments_style = "sphinx" |
| 35 | + |
| 36 | +# -- Options for HTML output ------------------------------------------------- |
| 37 | + |
| 38 | +# The theme to use for HTML and HTML Help pages. |
13 | 39 | html_theme = "furo" |
| 40 | + |
| 41 | +# Add any paths that contain custom static files (such as style sheets) here, |
| 42 | +# relative to this directory. They are copied after the builtin static files, |
| 43 | +# so a file named "default.css" will overwrite the builtin "default.css". |
| 44 | +html_static_path = ["_static"] |
| 45 | + |
| 46 | +# -- Extension configuration ------------------------------------------------- |
| 47 | + |
| 48 | +# Napoleon settings |
| 49 | +napoleon_google_docstring = True |
| 50 | +napoleon_numpy_docstring = False |
| 51 | +napoleon_include_init_with_doc = False |
| 52 | +napoleon_include_private_with_doc = False |
| 53 | +napoleon_include_special_with_doc = True |
| 54 | +napoleon_use_admonition_for_examples = False |
| 55 | +napoleon_use_admonition_for_notes = False |
| 56 | +napoleon_use_admonition_for_references = False |
| 57 | +napoleon_use_ivar = False |
| 58 | +napoleon_use_param = True |
| 59 | +napoleon_use_rtype = True |
| 60 | +napoleon_preprocess_types = False |
| 61 | +napoleon_type_aliases = None |
| 62 | +napoleon_attr_annotations = True |
| 63 | + |
| 64 | +# Autodoc settings |
| 65 | +autodoc_default_options = { |
| 66 | + "members": True, |
| 67 | + "member-order": "bysource", |
| 68 | + "special-members": "__init__", |
| 69 | + "undoc-members": True, |
| 70 | + "exclude-members": "__weakref__", |
| 71 | +} |
| 72 | +autodoc_typehints = "description" |
| 73 | +autodoc_mock_imports = ["django"] # Add any modules that might cause import errors during doc building |
| 74 | + |
| 75 | +# Intersphinx settings |
| 76 | +intersphinx_mapping = { |
| 77 | + "python": ("https://docs.python.org/3", None), |
| 78 | + "django": ("https://docs.djangoproject.com/en/stable/", "https://docs.djangoproject.com/en/stable/_objects/"), |
| 79 | +} |
| 80 | + |
| 81 | +# MyST Parser settings |
| 82 | +myst_enable_extensions = [ |
| 83 | + "amsmath", |
| 84 | + "colon_fence", |
| 85 | + "deflist", |
| 86 | + "dollarmath", |
| 87 | + "html_admonition", |
| 88 | + "html_image", |
| 89 | + "linkify", |
| 90 | + "replacements", |
| 91 | + "smartquotes", |
| 92 | + "substitution", |
| 93 | + "tasklist", |
| 94 | +] |
0 commit comments