-
Notifications
You must be signed in to change notification settings - Fork 575
/
conf.py
168 lines (131 loc) · 4.63 KB
/
conf.py
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
# This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Copyright the Hypothesis Authors.
# Individual contributors are listed in AUTHORS.rst and the git log.
#
# This Source Code Form is subject to the terms of the Mozilla Public License,
# v. 2.0. If a copy of the MPL was not distributed with this file, You can
# obtain one at https://mozilla.org/MPL/2.0/.
import datetime
import os
import sys
import types
import sphinx_rtd_theme
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "src"))
autodoc_member_order = "bysource"
autodoc_typehints = "none"
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.extlinks",
"sphinx.ext.viewcode",
"sphinx.ext.intersphinx",
"hoverxref.extension",
"sphinx_codeautolink",
"sphinx_selective_exclude.eager_only",
]
templates_path = ["_templates"]
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# General information about the project.
project = "Hypothesis"
author = "David R. MacIver"
copyright = f"2013-{datetime.datetime.utcnow().year}, {author}"
_d = {}
with open(
os.path.join(os.path.dirname(__file__), "..", "src", "hypothesis", "version.py")
) as f:
exec(f.read(), _d)
version = _d["__version__"]
release = _d["__version__"]
def setup(app):
if os.path.isfile(os.path.join(os.path.dirname(__file__), "..", "RELEASE.rst")):
app.tags.add("has_release_file")
# patch in mock array_api namespace so we can autodoc it
from hypothesis.extra.array_api import (
RELEASED_VERSIONS,
make_strategies_namespace,
mock_xp,
)
mod = types.ModuleType("xps")
mod.__dict__.update(
make_strategies_namespace(mock_xp, api_version=RELEASED_VERSIONS[-1]).__dict__
)
assert "xps" not in sys.modules
sys.modules["xps"] = mod
language = "en"
exclude_patterns = ["_build"]
pygments_style = "sphinx"
todo_include_todos = False
# See https://sphinx-hoverxref.readthedocs.io/en/latest/configuration.html
hoverxref_auto_ref = True
hoverxref_domains = ["py"]
hoverxref_role_types = {
"attr": "tooltip",
"class": "tooltip",
"const": "tooltip",
"exc": "tooltip",
"func": "tooltip",
"meth": "tooltip",
"mod": "tooltip",
"obj": "tooltip",
"ref": "tooltip",
}
intersphinx_mapping = {
"python": ("https://docs.python.org/3/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
"pytest": ("https://docs.pytest.org/en/stable/", None),
"django": ("https://django.readthedocs.io/en/stable/", None),
"dateutil": ("https://dateutil.readthedocs.io/en/stable/", None),
"redis": ("https://redis-py.readthedocs.io/en/stable/", None),
"attrs": ("https://www.attrs.org/en/stable/", None),
"sphinx": ("https://www.sphinx-doc.org/en/master/", None),
}
autodoc_mock_imports = ["numpy", "pandas", "redis", "django"]
codeautolink_autodoc_inject = False
codeautolink_global_preface = """
from hypothesis import *
import hypothesis.strategies as st
from hypothesis.strategies import *
"""
# This config value must be a dictionary of external sites, mapping unique
# short alias names to a base URL and a prefix.
# See http://sphinx-doc.org/ext/extlinks.html
_repo = "https://github.com/HypothesisWorks/hypothesis/"
extlinks = {
"commit": (_repo + "commit/%s", "commit %s"),
"gh-file": (_repo + "blob/master/%s", "%s"),
"gh-link": (_repo + "%s", "%s"),
"issue": (_repo + "issues/%s", "issue #%s"),
"pull": (_repo + "pull/%s", "pull request #%s"),
"pypi": ("https://pypi.org/project/%s/", "%s"),
"bpo": ("https://bugs.python.org/issue%s", "bpo-%s"),
"xp-ref": ("https://data-apis.org/array-api/latest/API_specification/%s", "%s"),
"wikipedia": ("https://en.wikipedia.org/wiki/%s", "%s"),
}
# -- Options for HTML output ----------------------------------------------
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_static_path = ["_static"]
htmlhelp_basename = "Hypothesisdoc"
html_favicon = "../../brand/favicon.ico"
html_logo = "../../brand/dragonfly-rainbow-150w.svg"
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {}
latex_documents = [
(master_doc, "Hypothesis.tex", "Hypothesis Documentation", author, "manual")
]
man_pages = [(master_doc, "hypothesis", "Hypothesis Documentation", [author], 1)]
texinfo_documents = [
(
master_doc,
"Hypothesis",
"Hypothesis Documentation",
author,
"Hypothesis",
"Advanced property-based testing for Python.",
"Miscellaneous",
)
]