| 1 |
# SPDX-License-Identifier: MIT |
| 2 |
|
| 3 |
from importlib import metadata |
| 4 |
from pathlib import Path |
| 5 |
|
| 6 |
|
| 7 |
# -- Path setup ----------------------------------------------------------- |
| 8 |
|
| 9 |
PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve() |
| 10 |
|
| 11 |
|
| 12 |
# -- General configuration ------------------------------------------------ |
| 13 |
|
| 14 |
doctest_global_setup = """ |
| 15 |
from attr import define, frozen, field, validators, Factory |
| 16 |
""" |
| 17 |
|
| 18 |
linkcheck_ignore = [ |
| 19 |
# We run into GitHub's rate limits. |
| 20 |
r"https://github.com/.*/(issues|pull)/\d+", |
| 21 |
# Rate limits and the latest tag is missing anyways on release. |
| 22 |
"https://github.com/python-attrs/attrs/tree/.*", |
| 23 |
] |
| 24 |
|
| 25 |
# In nitpick mode (-n), still ignore any of the following "broken" references |
| 26 |
# to non-types. |
| 27 |
nitpick_ignore = [ |
| 28 |
("py:class", "Any value"), |
| 29 |
("py:class", "callable"), |
| 30 |
("py:class", "callables"), |
| 31 |
("py:class", "tuple of types"), |
| 32 |
] |
| 33 |
|
| 34 |
# Add any Sphinx extension module names here, as strings. They can be |
| 35 |
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 36 |
# ones. |
| 37 |
extensions = [ |
| 38 |
"myst_parser", |
| 39 |
"sphinx.ext.autodoc", |
| 40 |
"sphinx.ext.doctest", |
| 41 |
"sphinx.ext.intersphinx", |
| 42 |
"sphinx.ext.todo", |
| 43 |
"notfound.extension", |
| 44 |
"sphinxcontrib.towncrier", |
| 45 |
] |
| 46 |
|
| 47 |
myst_enable_extensions = [ |
| 48 |
"colon_fence", |
| 49 |
"smartquotes", |
| 50 |
"deflist", |
| 51 |
] |
| 52 |
|
| 53 |
# Add any paths that contain templates here, relative to this directory. |
| 54 |
templates_path = ["_templates"] |
| 55 |
|
| 56 |
# The suffix of source filenames. |
| 57 |
source_suffix = ".rst" |
| 58 |
|
| 59 |
# The master toctree document. |
| 60 |
master_doc = "index" |
| 61 |
|
| 62 |
# General information about the project. |
| 63 |
project = "attrs" |
| 64 |
author = "Hynek Schlawack" |
| 65 |
copyright = f"2015, {author}" |
| 66 |
|
| 67 |
# The version info for the project you're documenting, acts as replacement for |
| 68 |
# |version| and |release|, also used in various other places throughout the |
| 69 |
# built documents. |
| 70 |
|
| 71 |
# The full version, including alpha/beta/rc tags. |
| 72 |
release = metadata.version("attrs") |
| 73 |
if "dev" in release: |
| 74 |
release = version = "UNRELEASED" |
| 75 |
else: |
| 76 |
# The short X.Y version. |
| 77 |
version = release.rsplit(".", 1)[0] |
| 78 |
|
| 79 |
# List of patterns, relative to source directory, that match files and |
| 80 |
# directories to ignore when looking for source files. |
| 81 |
exclude_patterns = ["_build"] |
| 82 |
|
| 83 |
# The reST default role (used for this markup: `text`) to use for all |
| 84 |
# documents. |
| 85 |
default_role = "any" |
| 86 |
|
| 87 |
# If true, '()' will be appended to :func: etc. cross-reference text. |
| 88 |
add_function_parentheses = True |
| 89 |
|
| 90 |
# -- Options for HTML output ---------------------------------------------- |
| 91 |
|
| 92 |
# The theme to use for HTML and HTML Help pages. See the documentation for |
| 93 |
# a list of builtin themes. |
| 94 |
|
| 95 |
html_theme = "furo" |
| 96 |
html_theme_options = { |
| 97 |
"sidebar_hide_name": True, |
| 98 |
"light_logo": "attrs_logo.svg", |
| 99 |
"dark_logo": "attrs_logo_white.svg", |
| 100 |
"top_of_page_button": None, |
| 101 |
"light_css_variables": { |
| 102 |
"font-stack": "Inter,sans-serif", |
| 103 |
"font-stack--monospace": "BerkeleyMono, MonoLisa, ui-monospace, " |
| 104 |
"SFMono-Regular, Menlo, Consolas, Liberation Mono, monospace", |
| 105 |
}, |
| 106 |
} |
| 107 |
html_css_files = ["custom.css"] |
| 108 |
|
| 109 |
|
| 110 |
# The name of an image file (within the static path) to use as favicon of the |
| 111 |
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 |
| 112 |
# pixels large. |
| 113 |
# html_favicon = None |
| 114 |
|
| 115 |
# Add any paths that contain custom static files (such as style sheets) here, |
| 116 |
# relative to this directory. They are copied after the builtin static files, |
| 117 |
# so a file named "default.css" will overwrite the builtin "default.css". |
| 118 |
html_static_path = ["_static"] |
| 119 |
|
| 120 |
# If false, no module index is generated. |
| 121 |
html_domain_indices = True |
| 122 |
|
| 123 |
# If false, no index is generated. |
| 124 |
html_use_index = True |
| 125 |
|
| 126 |
# If true, the index is split into individual pages for each letter. |
| 127 |
html_split_index = False |
| 128 |
|
| 129 |
# If true, links to the reST sources are added to the pages. |
| 130 |
html_show_sourcelink = False |
| 131 |
|
| 132 |
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. |
| 133 |
html_show_sphinx = True |
| 134 |
|
| 135 |
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. |
| 136 |
html_show_copyright = True |
| 137 |
|
| 138 |
# If true, an OpenSearch description file will be output, and all pages will |
| 139 |
# contain a <link> tag referring to it. The value of this option must be the |
| 140 |
# base URL from which the finished HTML is served. |
| 141 |
# html_use_opensearch = '' |
| 142 |
|
| 143 |
# Output file base name for HTML help builder. |
| 144 |
htmlhelp_basename = "attrsdoc" |
| 145 |
|
| 146 |
# -- Options for manual page output --------------------------------------- |
| 147 |
|
| 148 |
# One entry per manual page. List of tuples |
| 149 |
# (source start file, name, description, authors, manual section). |
| 150 |
man_pages = [("index", "attrs", "attrs Documentation", ["Hynek Schlawack"], 1)] |
| 151 |
|
| 152 |
|
| 153 |
# -- Options for Texinfo output ------------------------------------------- |
| 154 |
|
| 155 |
# Grouping the document tree into Texinfo files. List of tuples |
| 156 |
# (source start file, target name, title, author, |
| 157 |
# dir menu entry, description, category) |
| 158 |
texinfo_documents = [ |
| 159 |
( |
| 160 |
"index", |
| 161 |
"attrs", |
| 162 |
"attrs Documentation", |
| 163 |
"Hynek Schlawack", |
| 164 |
"attrs", |
| 165 |
"Python Clases Without Boilerplate", |
| 166 |
"Miscellaneous", |
| 167 |
) |
| 168 |
] |
| 169 |
|
| 170 |
epub_description = "Python Clases Without Boilerplate" |
| 171 |
|
| 172 |
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)} |
| 173 |
|
| 174 |
# Allow non-local URIs so we can have images in CHANGELOG etc. |
| 175 |
suppress_warnings = ["image.nonlocal_uri"] |
| 176 |
|
| 177 |
|
| 178 |
# -- Options for sphinxcontrib.towncrier extension ------------------------ |
| 179 |
|
| 180 |
towncrier_draft_autoversion_mode = "draft" |
| 181 |
towncrier_draft_include_empty = True |
| 182 |
towncrier_draft_working_directory = PROJECT_ROOT_DIR |
| 183 |
towncrier_draft_config_path = "pyproject.toml" |