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
|
from pathlib import Path
import importlib.metadata
import re
ROOT = Path(__file__).parent.parent
PACKAGE_SRC = ROOT / "jsonschema"
project = "jsonschema"
author = "Julian Berman"
copyright = "2013, " + author
release = importlib.metadata.version("jsonschema")
version = release.partition("-")[0]
language = "en"
default_role = "any"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
"sphinx.ext.coverage",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx_copybutton",
"sphinx_json_schema_spec",
"sphinxcontrib.spelling",
"sphinxext.opengraph",
]
cache_path = "_cache"
pygments_style = "lovelace"
pygments_dark_style = "one-dark"
html_theme = "furo"
# See sphinx-doc/sphinx#10785
_TYPE_ALIASES = {
"jsonschema._format._F", # format checkers
}
def _resolve_type_aliases(app, env, node, contnode):
if (
node["refdomain"] == "py"
and node["reftype"] == "class"
and node["reftarget"] in _TYPE_ALIASES
):
return app.env.get_domain("py").resolve_xref(
env,
node["refdoc"],
app.builder,
"data",
node["reftarget"],
node,
contnode,
)
def setup(app):
app.connect("missing-reference", _resolve_type_aliases)
# = Builders =
doctest_global_setup = """
from jsonschema import *
import jsonschema.validators
"""
def entire_domain(host):
return r"http.?://" + re.escape(host) + r"($|/.*)"
linkcheck_ignore = [
entire_domain("img.shields.io"),
"https://github.com/python-jsonschema/jsonschema/actions",
"https://github.com/python-jsonschema/jsonschema/workflows/CI/badge.svg",
]
# = Extensions =
# -- autoapi --
suppress_warnings = [
"autoapi.python_import_resolution",
"autoapi.toc_reference",
"epub.duplicated_toc_entry",
]
autoapi_root = "api"
autoapi_ignore = [
"*/_[a-z]*.py",
"*/__main__.py",
"*/benchmarks/*",
"*/cli.py",
"*/tests/*",
]
autoapi_options = [
"members",
"undoc-members",
"show-module-summary",
"imported-members",
]
autoapi_type = "python"
autoapi_dirs = [PACKAGE_SRC]
# -- autosectionlabel --
autosectionlabel_prefix_document = True
# -- intersphinx --
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"ujs": ("https://json-schema.org/understanding-json-schema/", None),
}
# -- sphinxcontrib-spelling --
spelling_word_list_filename = "spelling-wordlist.txt"
spelling_show_suggestions = True
|