forked from data-apis/dataframe-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconf.py
225 lines (188 loc) · 7.37 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
import sphinx_material
sys.path.insert(0, os.path.abspath('./API_specification'))
# -- Project information -----------------------------------------------------
project = 'Python dataframe API standard'
copyright = '2021-, Consortium for Python Data API Standards'
author = 'Consortium for Python Data API Standards'
# The full version, including alpha/beta/rc tags
release = '2023.04-DRAFT'
# -- General configuration ---------------------------------------------------
# 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',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx_markdown_tables',
'sphinx_copybutton',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.autodoc',
'sphinx_math_dollar',
'sphinx.ext.mathjax'
]
autosummary_generate = True
autodoc_typehints = 'signature'
autodoc_default_options = {
# 'attributes': True,
'members': True,
'special-members': True,
'undoc-members': True,
'exclude-members': '__annotations__, __dict__,__weakref__,__module__,__hash__',
}
add_module_names = False
napoleon_numpy_docstring = True
napoleon_custom_sections = [('Returns', 'params_style')]
default_role = 'code'
# Mathjax configuration:
mathjax3_config = {
"tex": {
"inlineMath": [['\\(', '\\)']],
"displayMath": [["\\[", "\\]"]],
}
}
# nitpicky = True makes Sphinx warn whenever a cross-reference target can't be
# found.
nitpicky = True
# autodoc wants to make cross-references for every type hint. But a lot of
# them don't actually refer to anything that we have a document for.
nitpick_ignore = [
('py:class', 'array'),
('py:class', 'DataFrame'),
('py:class', 'device'),
('py:class', 'DType'),
('py:class', 'NestedSequence'),
('py:class', 'collections.abc.Sequence'),
('py:class', 'PyCapsule'),
('py:class', 'enum.Enum'),
('py:class', 'ellipsis'),
('py:class', 'Scalar'),
('py:class', 'Bool'),
('py:class', 'optional'),
('py:class', 'NullType'),
('py:class', 'Namespace'),
]
# NOTE: this alias handling isn't used yet - added in anticipation of future
# need based on dataframe API aliases.
# In dataframe_object.py we have to use aliased names for some types because they
# would otherwise refer back to method objects of `dataframe`
autodoc_type_aliases = {
'dataframe': 'dataframe',
'Device': 'device',
'Dtype': 'dtype',
}
# Make autosummary show the signatures of functions in the tables using actual
# Python syntax. There's currently no supported way to do this, so we have to
# just patch out the function that processes the signatures. See
# https://github.com/sphinx-doc/sphinx/issues/10053.
import sphinx.ext.autosummary as autosummary_mod
if hasattr(autosummary_mod, '_module'):
# It's a sphinx deprecated module wrapper object
autosummary_mod = autosummary_mod._module
autosummary_mod.mangle_signature = lambda sig, max_chars=30: sig
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# MyST options
myst_heading_anchors = 3
myst_enable_extensions = ["colon_fence"]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
extensions.append("sphinx_material")
html_theme_path = sphinx_material.html_theme_path()
html_context = sphinx_material.get_html_context()
html_theme = 'sphinx_material'
# 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".
#html_static_path = ['_static']
# -- Material theme options (see theme.conf for more information) ------------
html_show_sourcelink = False
html_sidebars = {
"**": ["logo-text.html", "globaltoc.html", "localtoc.html", "searchbox.html"]
}
html_theme_options = {
# Set the name of the project to appear in the navigation.
'nav_title': f'Python dataframe API standard {release}',
# Set you GA account ID to enable tracking
#'google_analytics_account': 'UA-XXXXX',
# Specify a base_url used to generate sitemap.xml. If not
# specified, then no sitemap will be built.
#'base_url': 'https://project.github.io/project',
# Set the color and the accent color (see
# https://material.io/design/color/the-color-system.html)
'color_primary': 'indigo',
'color_accent': 'green',
# Set the repo location to get a badge with stats
#'repo_url': 'https://github.com/project/project/',
#'repo_name': 'Project',
"html_minify": False,
"html_prettify": False,
"css_minify": True,
"logo_icon": "",
"repo_type": "github",
"touch_icon": "images/apple-icon-152x152.png",
"theme_color": "#2196f3",
"master_doc": False,
# Visible levels of the global TOC; -1 means unlimited
'globaltoc_depth': 2,
# If False, expand all TOC entries
'globaltoc_collapse': True,
# If True, show hidden TOC entries
'globaltoc_includehidden': True,
"nav_links": [
{"href": "index", "internal": True, "title": "Dataframe API standard"},
{
"href": "https://data-apis.org",
"internal": False,
"title": "Consortium for Python Data API Standards",
},
],
"heroes": {
"index": "A common API for dataframe Python libraries",
#"customization": "Configuration options to personalize your site.",
},
"version_dropdown": True,
"version_json": "../versions.json",
"table_classes": ["plain"],
}
todo_include_todos = True
#html_favicon = "images/favicon.ico"
html_use_index = True
html_domain_indices = True
extlinks = {
"duref": (
"http://docutils.sourceforge.net/docs/ref/rst/" "restructuredtext.html#%s",
"",
),
"durole": ("http://docutils.sourceforge.net/docs/ref/rst/" "roles.html#%s", ""),
"dudir": ("http://docutils.sourceforge.net/docs/ref/rst/" "directives.html#%s", ""),
"pypa": ("https://packaging.python.org/%s", ""),
}
def process_signature(app, what, name, obj, options, signature, return_annotation):
if signature:
signature = signature.replace("dataframe_api._types.", "")
if return_annotation:
return_annotation = return_annotation.replace("dataframe_api._types.", "")
return signature, return_annotation
def setup(app):
app.connect("autodoc-process-signature", process_signature)