-
Notifications
You must be signed in to change notification settings - Fork 238
Expand file tree
/
Copy pathconf.py
More file actions
227 lines (199 loc) · 6.85 KB
/
conf.py
File metadata and controls
227 lines (199 loc) · 6.85 KB
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
226
227
import os
import re
import sys
from os import path
sys.path.insert(0, path.abspath('..'))
project = 'DocArray'
slug = re.sub(r'\W+', '-', project.lower())
author = 'Jina AI'
copyright = 'Jina AI Limited. All rights reserved.'
source_suffix = ['.rst', '.md']
master_doc = 'index'
language = 'en'
repo_dir = '../'
try:
if 'DOCARRAY_VERSION' not in os.environ:
pkg_name = 'docarray'
libinfo_py = path.join(repo_dir, pkg_name, '__init__.py')
libinfo_content = open(libinfo_py, 'r').readlines()
version_line = [
l.strip() for l in libinfo_content if l.startswith('__version__')
][0]
exec(version_line)
else:
__version__ = os.environ['DOCARRAY_VERSION']
except FileNotFoundError:
__version__ = '0.0.0'
version = __version__
release = __version__
templates_path = ['_templates']
exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
'tests',
'page_templates',
'.github',
]
pygments_style = 'rainbow_dash'
html_theme = 'furo'
base_url = '/'
html_baseurl = 'https://docarray.jina.ai'
sitemap_url_scheme = '{link}'
sitemap_locales = [None]
sitemap_filename = "sitemap.xml"
html_theme_options = {
'light_logo': 'logo-light.svg',
'dark_logo': 'logo-dark.svg',
"sidebar_hide_name": True,
"light_css_variables": {
"color-brand-primary": "#009191",
"color-brand-content": "#009191",
},
"dark_css_variables": {
"color-brand-primary": "#FBCB67",
"color-brand-content": "#FBCB67",
},
# PLEASE DO NOT DELETE the empty line between `start-announce` and `end-announce`
# PLEASE DO NOT DELETE `start-announce`/ `end-announce` it is used for our dev bot to inject announcement from GH
# start-announce
# end-announce
}
html_static_path = ['_static']
html_extra_path = ['html_extra']
html_css_files = [
'main.css',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta2/css/all.min.css',
]
html_js_files = ['https://cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js']
htmlhelp_basename = slug
html_show_sourcelink = False
html_favicon = '_static/favicon.png'
latex_documents = [(master_doc, f'{slug}.tex', project, author, 'manual')]
man_pages = [(master_doc, slug, project, [author], 1)]
texinfo_documents = [
(master_doc, slug, project, author, slug, project, 'Miscellaneous')
]
epub_title = project
epub_exclude_files = ['search.html']
# -- Extension configuration -------------------------------------------------
extensions = [
'sphinx.ext.autodoc',
'sphinx_autodoc_typehints',
'sphinx.ext.viewcode',
'sphinx.ext.coverage',
'sphinxcontrib.apidoc',
'sphinxarg.ext',
'sphinx_markdown_tables',
'sphinx_copybutton',
'sphinx_sitemap',
'sphinx.ext.intersphinx',
'sphinxext.opengraph',
'notfound.extension',
'myst_parser',
'sphinx_design',
'sphinx_inline_tabs',
]
myst_enable_extensions = ['colon_fence', 'substitution']
# -- Custom 404 page
# sphinx-notfound-page
# https://github.com/readthedocs/sphinx-notfound-page
notfound_context = {
'title': 'Page Not Found',
'body': '''
<h1>Page Not Found</h1>
<p>Oops, we couldn't find that page. </p>
<p>You can try "asking our docs" on the right corner of the page to find answer.</p>
<p>Otherwise, <a href="https://github.com/jina-ai/docarray/">please create a Github issue</a> and one of our team will respond.</p>
''',
}
notfound_no_urls_prefix = True
apidoc_module_dir = repo_dir
apidoc_output_dir = 'api'
apidoc_excluded_paths = ['tests', 'legacy', 'hub', 'toy*', 'setup.py']
apidoc_separate_modules = True
apidoc_extra_args = ['-t', 'template/']
autodoc_member_order = 'bysource'
autodoc_mock_imports = ['argparse', 'numpy', 'np', 'tensorflow', 'torch', 'scipy']
autoclass_content = 'both'
set_type_checking_flag = False
html_last_updated_fmt = ''
nitpicky = True
nitpick_ignore = [('py:class', 'type')]
linkcheck_ignore = [
# Avoid link check on local uri
'http://0.0.0.0:*',
'pods/encode.yml',
'https://github.com/jina-ai/docarray/commit/*',
'.github/*',
'extra-requirements.txt',
'fastentrypoints.py' '../../101',
'../../102',
'http://www.twinsun.com/tz/tz-link.htm', # Broken link from pytz library
'https://urllib3.readthedocs.io/en/latest/contrib.html#google-app-engine', # Broken link from urllib3 library
'https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-20-04/',
# This link works but gets 403 error on linkcheck
]
linkcheck_timeout = 20
linkcheck_retries = 2
linkcheck_anchors = False
ogp_site_url = 'https://docarray.jina.ai/'
ogp_image = 'https://docarray.jina.ai/_static/banner.png'
ogp_use_first_image = True
ogp_description_length = 300
ogp_type = 'website'
ogp_site_name = f'DocArray {os.environ.get("SPHINX_MULTIVERSION_VERSION", version)} Documentation'
ogp_custom_meta_tags = [
'<meta name="twitter:card" content="summary_large_image">',
'<meta name="twitter:site" content="@JinaAI_">',
'<meta name="twitter:creator" content="@JinaAI_">',
'<meta name="description" content="DocArray is a library for nested, unstructured data such as text, image, audio, video, 3D mesh.">',
'<meta property="og:description" content="DocArray is a library for nested, unstructured data such as text, image, audio, video, 3D mesh. It allows deep learning engineers to easily preprocess, embed, search, recommend and transfer the data.">',
'''
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-48WE9V68SD"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-48WE9V68SD');
</script>
<script async defer src="https://buttons.github.io/buttons.js"></script>
''',
]
def add_server_address(app):
# This makes variable `server_address` available to docbot.js
server_address = app.config['server_address']
js_text = "var server_address = '%s';" % server_address
app.add_js_file(None, body=js_text)
def setup(app):
from sphinx.domains.python import PyField
from sphinx.util.docfields import Field
from sphinx.locale import _
app.add_object_type(
'confval',
'confval',
objname='configuration value',
indextemplate='pair: %s; configuration value',
doc_field_types=[
PyField(
'type',
label=_('Type'),
has_arg=False,
names=('type',),
bodyrolename='class',
),
Field(
'default',
label=_('Default'),
has_arg=False,
names=('default',),
),
],
)
# app.add_config_value(
# name='server_address',
# default=os.getenv('JINA_DOCSBOT_SERVER', 'https://docsbot.jina.ai'),
# rebuild='',
# )
# app.connect('builder-inited', add_server_address)