forked from IBM/unitxt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconf.py
93 lines (71 loc) · 2.43 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
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
from dataclasses import Field as _Field
import unitxt
from unitxt.artifact import Artifact
from unitxt.dataclass import Field
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from catalog import create_catalog_docs
create_catalog_docs()
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = "Unitxt"
copyright = "2023, IBM Research"
author = "IBM Research"
release = unitxt.__version__
html_short_title = "Unitxt"
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.napoleon",
"sphinxext.opengraph",
]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "piccolo_theme"
html_logo = "./static/logo.png"
html_theme_options = {
"show_theme_credit": False,
"source_url": "https://github.com/IBM/unitxt/",
}
html_static_path = ["_static"]
html_css_files = ["custom.css"]
html_js_files = ["custom.js"]
html_show_sphinx = False
html_favicon = "./static/favicon.ico"
html_title = "Unitxt"
ogp_image = (
"https://raw.githubusercontent.com/IBM/unitxt/main/docs/static/opg_image.png"
)
autodoc_default_flags = [
"members",
"private-members",
"special-members",
#'undoc-members',
"show-inheritance",
]
def autodoc_skip_member(app, what, name, obj, would_skip, options):
if would_skip:
return True
if isinstance(obj, (Field, _Field, bool, int, str, float)):
return True
if obj is None or type(obj) is object:
return True
if hasattr(obj, "__qualname__"):
class_name = obj.__qualname__.split(".")[0]
if (
class_name
and Artifact.is_registered_class_name(class_name)
and class_name != name
):
return True
return None
def setup(app):
app.connect("autodoc-skip-member", autodoc_skip_member)