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