| 1 |
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html |
| 2 |
# For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE |
| 3 |
# Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt |
| 4 |
|
| 5 |
import doctest |
| 6 |
import os |
| 7 |
import sys |
| 8 |
from datetime import datetime, timezone |
| 9 |
|
| 10 |
# If extensions (or modules to document with autodoc) are in another directory, |
| 11 |
# add these directories to sys.path here. If the directory is relative to the |
| 12 |
# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 13 |
sys.path.insert(0, os.path.abspath("..")) |
| 14 |
|
| 15 |
# -- General configuration ----------------------------------------------------- |
| 16 |
|
| 17 |
# Add any Sphinx extension module names here, as strings. They can be extensions |
| 18 |
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. |
| 19 |
extensions = [ |
| 20 |
"sphinx.ext.autodoc", |
| 21 |
"sphinx.ext.autosummary", |
| 22 |
"sphinx.ext.doctest", |
| 23 |
"sphinx.ext.intersphinx", |
| 24 |
"sphinx.ext.napoleon", |
| 25 |
"sphinx.ext.viewcode", |
| 26 |
] |
| 27 |
|
| 28 |
# Add any paths that contain templates here, relative to this directory. |
| 29 |
templates_path = ["_templates"] |
| 30 |
|
| 31 |
# The suffix of source filenames. |
| 32 |
source_suffix = ".rst" |
| 33 |
|
| 34 |
# Pin the language so warning messages are identical for everyone, whatever |
| 35 |
# the locale of the machine running the build happens to be. |
| 36 |
language = "en" |
| 37 |
|
| 38 |
# Single backticks mean code. Without this they mean "title reference", which |
| 39 |
# renders as italics, and the ChangeLog is full of `infer` and `**kwargs` that |
| 40 |
# were plainly meant to be code. |
| 41 |
default_role = "code" |
| 42 |
|
| 43 |
# The master toctree document. |
| 44 |
root_doc = "index" |
| 45 |
|
| 46 |
# General information about the project. |
| 47 |
project = "Astroid" |
| 48 |
current_year = datetime.now(timezone.utc).year |
| 49 |
contributors = "Logilab, and astroid contributors" |
| 50 |
copyright = f"2003-{current_year}, {contributors}" |
| 51 |
|
| 52 |
from astroid.__pkginfo__ import __version__ # noqa |
| 53 |
|
| 54 |
release = __version__ |
| 55 |
|
| 56 |
# List of patterns, relative to source directory, that match files and |
| 57 |
# directories to ignore when looking for source files. |
| 58 |
exclude_patterns = ["_build"] |
| 59 |
|
| 60 |
# The name of the Pygments (syntax highlighting) style to use. |
| 61 |
pygments_style = "sphinx" |
| 62 |
|
| 63 |
# -- Options for HTML output --------------------------------------------------- |
| 64 |
|
| 65 |
# The theme to use for HTML and HTML Help pages. See the documentation for |
| 66 |
# a list of builtin themes. |
| 67 |
html_theme = "furo" |
| 68 |
|
| 69 |
# Add any paths that contain custom static files (such as style sheets) here, |
| 70 |
# relative to this directory. They are copied after the builtin static files, |
| 71 |
# so a file named "default.css" will overwrite the builtin "default.css". |
| 72 |
html_static_path = ["media"] |
| 73 |
|
| 74 |
# Output file base name for HTML help builder. |
| 75 |
htmlhelp_basename = "Pylintdoc" |
| 76 |
|
| 77 |
# -- Options for Autodoc ------------------------------------------------------- |
| 78 |
|
| 79 |
autodoc_default_options = { |
| 80 |
"members": True, |
| 81 |
"show-inheritance": True, |
| 82 |
"undoc-members": True, |
| 83 |
} |
| 84 |
intersphinx_mapping = { |
| 85 |
# Use dev so that the documentation builds when we are adding support for |
| 86 |
# upcoming Python versions. |
| 87 |
"python": ("https://docs.python.org/dev", None), |
| 88 |
} |
| 89 |
|
| 90 |
# -- Options for the doctest builder ------------------------------------------- |
| 91 |
|
| 92 |
# Run the ``>>>`` examples with ``tox -e doctest``, so that one that stops being |
| 93 |
# true is noticed. The examples print nodes, whose repr ends in the address the |
| 94 |
# node happens to live at, so they are written ``at 0x...`` and matched loosely. |
| 95 |
doctest_default_flags = ( |
| 96 |
doctest.DONT_ACCEPT_TRUE_FOR_1 |
| 97 |
| doctest.ELLIPSIS |
| 98 |
| doctest.IGNORE_EXCEPTION_DETAIL |
| 99 |
| doctest.NORMALIZE_WHITESPACE |
| 100 |
) |
| 101 |
|
| 102 |
# -- Options for cross-reference checking -------------------------------------- |
| 103 |
|
| 104 |
# Warn about every cross-reference that does not resolve. Combined with the |
| 105 |
# ``-W`` passed by ``tox -e docs`` and by ``fail_on_warning`` in |
| 106 |
# ``.readthedocs.yaml``, a reference to something that does not exist (or that |
| 107 |
# is written without its module path) breaks the build instead of silently |
| 108 |
# rendering as plain text. |
| 109 |
nitpicky = True |
| 110 |
|
| 111 |
# Targets that can never resolve, so that ``nitpicky`` only reports mistakes we |
| 112 |
# can actually act on. Both halves of each pair are regexes matched in full. |
| 113 |
# |
| 114 |
# Keep this list short. Every entry hides a category of broken link, so add one |
| 115 |
# only when the target genuinely cannot be documented; a public class or method |
| 116 |
# that is merely written without its module path belongs in the docs, not here. |
| 117 |
nitpick_ignore_regex = [ |
| 118 |
# Private modules, private helpers and TypeVars, e.g. |
| 119 |
# ``astroid.nodes._base_nodes.Statement``. Autodoc prints the annotations |
| 120 |
# of public functions as they are written in the source, and these are not |
| 121 |
# part of the public API, so they have no page to link to. |
| 122 |
(r"py:.*", r"(?:\w+\.)*_\w+(?:\.\w+)*"), |
| 123 |
# Same reason, for annotations written relative to their own module, e.g. |
| 124 |
# ``node_classes.NodeNG``. The name Sphinx sees has no module path in it. |
| 125 |
(r"py:class", r"(?:arguments|constraint|node_classes|objectmodel|objects)\.\w+"), |
| 126 |
# ``Uninferable`` is a singleton object, not a class, so it can never be a |
| 127 |
# ``:class:`` target. Prose should link to :obj:`~astroid.Uninferable`. |
| 128 |
(r"py:class", r"Uninferable"), |
| 129 |
# Type aliases and base classes used unqualified in annotations. They exist |
| 130 |
# only to spell out signatures, and have no page of their own. |
| 131 |
(r"py:class", r"FrameType|InferenceContext|InferenceResult"), |
| 132 |
(r"py:class", r"LookupMixIn|SuccessfulInferenceResult"), |
| 133 |
] |
| 134 |
|
| 135 |
# -- Options for the linkcheck builder ----------------------------------------- |
| 136 |
|
| 137 |
# Checked by a scheduled workflow rather than on every pull request, because it |
| 138 |
# needs the network and so fails for reasons that have nothing to do with a |
| 139 |
# change. |
| 140 |
linkcheck_ignore = [ |
| 141 |
# Bitbucket dropped Mercurial hosting in 2020 and these two changelog |
| 142 |
# entries point at repositories that went with it. |
| 143 |
r"https://bitbucket\.org/.*", |
| 144 |
] |