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
|
from importlib import metadata
from typing import TYPE_CHECKING
if TYPE_CHECKING:
import sphinx.application
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
"sphinx.ext.viewcode",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "pluggy"
copyright = "2016, Holger Krekel"
author = "Holger Krekel"
release = metadata.version(project)
# The short X.Y version.
version = ".".join(release.split(".")[:2])
language = "en"
pygments_style = "sphinx"
# html_logo = "_static/img/plug.png"
html_theme = "alabaster"
html_theme_options = {
"logo": "img/plug.png",
"description": "The pytest plugin system",
"github_user": "pytest-dev",
"github_repo": "pluggy",
"github_button": "true",
"github_banner": "true",
"github_type": "star",
"badge_branch": "main",
"page_width": "1080px",
"sidebar_width": "300px",
"fixed_sidebar": "false",
}
html_sidebars = {
"**": ["about.html", "localtoc.html", "relations.html", "searchbox.html"]
}
html_static_path = ["_static"]
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "pluggy", "pluggy Documentation", [author], 1)]
autodoc_member_order = "bysource"
nitpicky = True
nitpick_ignore = {
# Don't want to expose this yet (see #428).
("py:class", "pluggy._tracing.TagTracerSub"),
# Compat hack, don't want to expose it.
("py:class", "pluggy._manager.DistFacade"),
# `types.ModuleType` turns into `module` but then fails to resolve...
("py:class", "module"),
# Just a TypeVar.
("py:obj", "pluggy._result.ResultType"),
("py:class", "pluggy._result.ResultType"),
}
# -- 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 = [
(
master_doc,
"pluggy",
"pluggy Documentation",
author,
"pluggy",
"One line description of project.",
"Miscellaneous",
)
]
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"pytest": ("https://docs.pytest.org/en/latest", None),
"setuptools": ("https://setuptools.pypa.io/en/latest", None),
"tox": ("https://tox.wiki/en/latest", None),
"devpi": ("https://devpi.net/docs/devpi/devpi/stable/+doc/", None),
"kedro": ("https://docs.kedro.org/en/latest/", None),
}
def configure_logging(app: "sphinx.application.Sphinx") -> None:
"""Configure Sphinx's WarningHandler to handle (expected) missing include."""
import logging
import sphinx.util.logging
class WarnLogFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
"""Ignore warnings about missing include with "only" directive.
Ref: https://github.com/sphinx-doc/sphinx/issues/2150."""
if (
record.msg.startswith('Problems with "include" directive path:')
and "_changelog_towncrier_draft.rst" in record.msg
):
return False
return True
logger = logging.getLogger(sphinx.util.logging.NAMESPACE)
warn_handler = [x for x in logger.handlers if x.level == logging.WARNING]
assert len(warn_handler) == 1, warn_handler
warn_handler[0].filters.insert(0, WarnLogFilter())
def setup(app: "sphinx.application.Sphinx") -> None:
configure_logging(app)
|