attrs/docs/conf.py

194 lines
5.7 KiB
Python
Raw Normal View History

2021-12-27 08:29:09 +00:00
# SPDX-License-Identifier: MIT
2024-07-17 12:14:35 +00:00
import os
from importlib import metadata
from pathlib import Path
2024-07-17 12:14:35 +00:00
# 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()
2015-01-27 16:53:17 +00:00
# -- General configuration ------------------------------------------------
doctest_global_setup = """
from attr import define, frozen, field, validators, Factory
"""
linkcheck_ignore = [
2021-12-28 05:47:51 +00:00
# We run into GitHub's rate limits.
r"https://github.com/.*/(issues|pull)/\d+",
2022-12-21 08:59:27 +00:00
# Rate limits and the latest tag is missing anyways on release.
"https://github.com/python-attrs/attrs/tree/.*",
]
# 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"),
]
2015-01-27 16:53:17 +00:00
# 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",
2018-06-10 17:40:07 +00:00
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"notfound.extension",
"sphinxcontrib.towncrier",
2015-01-27 16:53:17 +00:00
]
myst_enable_extensions = [
"colon_fence",
"smartquotes",
"deflist",
]
2015-01-27 16:53:17 +00:00
# Add any paths that contain templates here, relative to this directory.
2018-06-10 17:40:07 +00:00
templates_path = ["_templates"]
2015-01-27 16:53:17 +00:00
# The suffix of source filenames.
2018-06-10 17:40:07 +00:00
source_suffix = ".rst"
2015-01-27 16:53:17 +00:00
# The master toctree document.
2018-06-10 17:40:07 +00:00
master_doc = "index"
2015-01-27 16:53:17 +00:00
# General information about the project.
2021-11-15 08:59:21 +00:00
project = "attrs"
2021-11-15 09:08:16 +00:00
author = "Hynek Schlawack"
copyright = f"2015, {author}"
2015-01-27 16:53:17 +00:00
# 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")
2023-07-09 12:25:19 +00:00
if "dev" in release:
release = version = "UNRELEASED"
else:
# The short X.Y version.
version = release.rsplit(".", 1)[0]
2015-01-27 16:53:17 +00:00
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
2018-06-10 17:40:07 +00:00
exclude_patterns = ["_build"]
2015-01-27 16:53:17 +00:00
# The reST default role (used for this markup: `text`) to use for all
# documents.
default_role = "any"
2015-01-27 16:53:17 +00:00
# If true, '()' will be appended to :func: etc. cross-reference text.
2017-02-20 12:41:20 +00:00
add_function_parentheses = True
2015-01-27 16:53:17 +00:00
# -- 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"
2017-05-23 23:11:37 +00:00
html_theme_options = {
"sidebar_hide_name": True,
"light_logo": "attrs_logo.svg",
"dark_logo": "attrs_logo_white.svg",
"top_of_page_buttons": [],
2023-11-23 07:28:31 +00:00
"light_css_variables": {
"font-stack": "Inter,sans-serif",
"font-stack--monospace": "BerkeleyMono, MonoLisa, ui-monospace, "
"SFMono-Regular, Menlo, Consolas, Liberation Mono, monospace",
},
2017-05-23 23:11:37 +00:00
}
2023-11-23 07:28:31 +00:00
html_css_files = ["custom.css"]
2015-01-27 16:53:17 +00:00
# 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.
2017-02-20 12:41:20 +00:00
# html_favicon = None
2015-01-27 16:53:17 +00:00
# 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".
2018-06-10 17:40:07 +00:00
html_static_path = ["_static"]
2015-01-27 16:53:17 +00:00
# If false, no module index is generated.
2017-02-20 12:41:20 +00:00
html_domain_indices = True
2015-01-27 16:53:17 +00:00
# If false, no index is generated.
2017-02-20 12:41:20 +00:00
html_use_index = True
2015-01-27 16:53:17 +00:00
# If true, the index is split into individual pages for each letter.
2017-02-20 12:41:20 +00:00
html_split_index = False
2015-01-27 16:53:17 +00:00
# If true, links to the reST sources are added to the pages.
2017-02-20 12:41:20 +00:00
html_show_sourcelink = False
2015-01-27 16:53:17 +00:00
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
2017-02-20 12:41:20 +00:00
html_show_sphinx = True
2015-01-27 16:53:17 +00:00
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
2017-02-20 12:41:20 +00:00
html_show_copyright = True
2015-01-27 16:53:17 +00:00
# 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.
2017-02-20 12:41:20 +00:00
# html_use_opensearch = ''
2015-01-27 16:53:17 +00:00
# Output file base name for HTML help builder.
2018-06-10 17:40:07 +00:00
htmlhelp_basename = "attrsdoc"
2015-01-27 16:53:17 +00:00
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
2021-11-15 08:59:21 +00:00
man_pages = [("index", "attrs", "attrs Documentation", ["Hynek Schlawack"], 1)]
2015-01-27 16:53:17 +00:00
# -- 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 = [
2018-06-10 17:40:07 +00:00
(
"index",
"attrs",
2021-11-15 08:59:21 +00:00
"attrs Documentation",
"Hynek Schlawack",
2018-06-10 17:40:07 +00:00
"attrs",
2024-01-08 06:37:20 +00:00
"Python Classes Without Boilerplate",
2018-06-10 17:40:07 +00:00
"Miscellaneous",
)
2015-01-27 16:53:17 +00:00
]
2024-01-08 06:37:20 +00:00
epub_description = "Python Classes Without Boilerplate"
2021-11-15 09:08:16 +00:00
2023-04-27 00:31:29 +00:00
intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
2017-03-04 07:43:34 +00:00
# Allow non-local URIs so we can have images in CHANGELOG etc.
2018-06-10 17:40:07 +00:00
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"