-
Notifications
You must be signed in to change notification settings - Fork 377
/
conf.py
312 lines (266 loc) · 9.85 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# Copyright 2021-present, the Recognai S.L. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 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
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
import os
try:
import argilla as rg
version_ = rg.__version__
except ModuleNotFoundError:
version_ = os.environ["VERSION"]
project = "Argilla"
copyright = "2022, Argilla.io"
author = "Argilla.io"
# Normally the full version, including alpha/beta/rc tags.
release = version_
# The short X.Y version
version = ".".join(release.split(".")[0:2])
# -- 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",
"nbsphinx",
"notfound.extension",
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinxext.opengraph",
"sphinx_design",
"sphinx_copybutton",
]
myst_enable_extensions = [
"colon_fence",
"substitution",
]
myst_substitutions = {
"pipversion": "" if "dev" in release else "==" + release,
"dockertag": "master" if "dev" in release else "v" + release,
}
myst_substitutions[
"dockercomposeyaml"
] = """```yaml
# docker-compose.yaml
version: "3"
services:
argilla:
image: argilla/argilla-server:{}
ports:
- "80:80"
environment:
ELASTICSEARCH: <elasticsearch-host_and_port>
restart: unless-stopped
```""".format(
myst_substitutions["dockertag"]
)
myst_substitutions[
"dockercomposeuseryaml"
] = """```yaml
# docker-compose.yaml
services:
argilla:
image: argilla/argilla-server:{}
ports:
- "6900:80"
environment:
ELASTICSEARCH: http://elasticsearch:9200
ARGILLA_LOCAL_AUTH_USERS_DB_FILE: /config/.users.yaml
volumes:
# We mount the local file .users.yaml in remote container in path /config/.users.yaml
- ${}/.users.yaml:/config/.users.yaml
...
```""".format(
myst_substitutions["dockertag"], "PWD"
)
# Do not execute the notebooks when building the docs
nbsphinx_execute = "never"
# open html file as python string
getting_started_html = open("./_common/getting_started.html", "r").read()
next_steps_html = open("./_common/next_steps.html", "r").read()
# Plotly + Hide input/output prompts (cell counts)
autodoc_typehints = "description"
# 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"]
if not os.getenv("READTHEDOCS"):
notfound_urls_prefix = None
else:
lang, docs_version = (
os.getenv("READTHEDOCS_LANGUAGE", "en"),
os.getenv("READTHEDOCS_VERSION", "latest"),
)
notfound_urls_prefix = f"/{lang}/{docs_version}/"
docs_version = os.getenv("READTHEDOCS_VERSION", "latest")
if docs_version == "latest":
branch = "main"
else:
branch = docs_version.replace("-", "/")
nbsphinx_prolog = (
"""
.. raw:: html
<script>require=requirejs;</script>
<script>
window.PlotlyConfig = {MathJaxConfig: 'local'}
requirejs.config({
paths: {
'plotly': ['https://cdn.plot.ly/plotly-latest.min']
},
});
if(!window.Plotly) {
{
require(['plotly'], function(plotly) {window.Plotly=plotly;});
}
}
</script>
<style>
.nbinput .prompt,
.nboutput .prompt {
display: none;
}
</style>
"""
+ f"""
.. raw:: html
{getting_started_html}
"""
+ """
.. raw:: html
<div class="open-in-colab__wrapper">
<a href="https://colab.research.google.com/github/argilla-io/argilla/blob/"""
+ branch
+ """/docs/_source/{{ env.doc2path(env.docname, base=None) }}" target="_blank"><img src="https://colab.research.google.com/assets/colab-badge.svg" style="display: inline; margin: 0" alt="Open In Colab"/></a> """
+ """<a href="https://github.com/argilla-io/argilla/tree/"""
+ branch
+ """/docs/_source/{{ env.doc2path(env.docname, base=None) }}" target="_blank"><img src="https://img.shields.io/badge/github-view%20source-black.svg" style="display: inline; margin: 0" alt="View Notebook on GitHub"/></a>
</div>
"""
)
nbsphinx_epilog = f"""
.. raw:: html
{next_steps_html}
"""
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "furo"
# 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"]
# Theme options
html_favicon = "_static/images/favicon.ico"
# These paths are either relative to html_static_path
# or fully qualified paths (eg. https://...)
html_css_files = ["css/custom.css"]
html_js_files = ["js/githubStargazers.js", "js/sidebarScrollPosition.js"]
html_theme_options = {
"top_of_page_button": None,
"sidebar_hide_name": True,
"light_logo": "images/logo-light-mode.svg",
"dark_logo": "images/logo-dark-mode.svg",
"light_css_variables": {
"color-sidebar-background": "#FFFFFF",
"color-sidebar-background-border": "#e9eaed",
"color-sidebar-caption-text": "#484848",
"color-sidebar-link-text": "#484848",
"color-sidebar-link-text--top-level": "#484848",
"color-sidebar-item-background--current": "transparent",
"color-sidebar-item-background--hover": "transparent",
"color-sidebar-item-expander-background": "transparent",
"color-sidebar-item-expander-background--hover": "transparent",
"color-sidebar-search-text": "#484848",
"color-sidebar-search-background": "#FFFFFF",
"color-sidebar-search-background--focus": "#FFFFFF",
"color-sidebar-search-border": "#b9b9b9",
"color-sidebar-search-border-focus": "#484848",
"color-sidebar-current-text": "#ff675f",
"color-content-foreground": "#484848",
"color-toc-title": "#212529",
"color-toc-item-text--hover": "#484848",
"color-toc-item-text--active": "#484848",
"color-table-header": "#FDDACA",
"color-table-bg": "#FFE5D9",
"color-table-row": "#FEEDE6",
"color-link": "#ff675f",
"color-link--hover": "#ff675f",
"content-padding": "5em",
"content-padding--small": "2em",
"color-search-icon": "#484848",
"color-search-placeholder": "#484848",
"color-literal": "#FF675F",
"toc-spacing-vertical": "3em",
"color-page-info": "#646776",
"toc-item-spacing-vertical": "1em",
"color-img-background": "#ffffff",
"sidebar-tree-space-above": "0",
"sidebar-caption-space-above": "0",
},
"dark_css_variables": {
"color-sidebar-background": "#131416",
"color-sidebar-background-border": "#303335",
"color-sidebar-caption-text": "#FFFFFF",
"color-sidebar-link-text": "#FFFFFF",
"color-sidebar-link-text--top-level": "#FFFFFF",
"color-sidebar-item-background--current": "none",
"color-sidebar-item-background--hover": "none",
"color-sidebar-item-expander-background": "transparent",
"color-sidebar-item-expander-background--hover": "transparent",
"color-sidebar-search-text": "#FFFFFF",
"color-sidebar-search-background": "#131416",
"color-sidebar-search-background--focus": "transparent",
"color-sidebar-search-border": "#FFFFFF",
"color-sidebar-search-border-focus": "#FFFFFF",
"color-sidebar-search-foreground": "#FFFFFF",
"color-sidebar-current-text": "#FFC2BF",
"color-content-foreground": "#FFFFFF",
"color-toc-title": "#FFFFFF",
"color-toc-item-text--hover": "#FFFFFF",
"color-toc-item-text--active": "#FFFFFF",
"color-table-header": "#131416",
"color-table-bg": "#232427",
"color-table-row": "#444444",
"color-link": "#FFC2BF",
"color-link--hover": "#FFC2BF",
"color-search-icon": "#FFFFFF",
"color-search-placeholder": "#FFFFFF",
"color-literal": "#F8C0A7",
"color-page-info": "#FFFFFF",
"color-img-background": "#757575",
"sidebar-tree-space-above": "0",
"sidebar-caption-space-above": "0",
},
}
pygments_style = "material"
pygments_dark_style = "material"
# Open graph meta
ogp_image = "_static/images/og-doc.png"
ogp_custom_meta_tags = [
'<meta name="twitter:card" content="summary_large_image" />',
]