-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathconf.py
More file actions
139 lines (120 loc) · 6.01 KB
/
conf.py
File metadata and controls
139 lines (120 loc) · 6.01 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
# 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
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import pathlib
import datetime
curr_file_dir = pathlib.Path(__file__).parent.resolve()
project = "GiGL"
author = "Snap Inc"
copyright = f"{datetime.datetime.now().year}, {author}"
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
# https://www.sphinx-doc.org/en/master/usage/extensions/index.html
extensions = [
"sphinx.ext.autodoc", # Pull in documentation from docstrings
"sphinx_autodoc_typehints", # Use Python annotations for documenting acceptable argument and return types
"sphinx.ext.napoleon", # Support for Google style docstrings
"sphinx.ext.viewcode", # Add links to the source code
"sphinx.ext.autosummary", # Generates function/method/attribute summary lists
"autoapi.extension", # Generate API docs without need to import modules: https://sphinx-autoapi.readthedocs.io/en/latest/index.html
"sphinx_design", # Needed by themes
"myst_nb", # Support for rendering Jupyter Notebooks: https://myst-nb.readthedocs.io/en/v1.2.0/
"sphinx_copybutton", # Support for copying code snippets: https://sphinx-copybutton.readthedocs.io/
]
autoapi_type = 'python'
autoapi_dirs = ['gigl', 'snapchat']
autoapi_root = "docs/api"
autoapi_ignore = [
"*migrations*", # Default value: https://sphinx-autoapi.readthedocs.io/en/latest/reference/config.html#confval-autoapi_ignore
"**/setup.py",
"**/__pycache__/**",
"**/tests/**",
"**_pb2.py", # Ignore generated protobuf files; by doing this we force use the _pb2.pyi files - they are more parsable
]
autodoc_typehints = "description" # Show typehints as content of the function or method
autoapi_options = [ # For config options see: https://sphinx-autoapi.readthedocs.io/en/latest/reference/config.html
'members', # Display children of an object
'undoc-members', # Display objects that have no docstring
'show-inheritance', # Display a list of base classes below the class signature.
'show-module-summary', # Include autosummary directives in generated module documentation.
'imported-members' # Display imported objects from top level package or module
]
typehints_fully_qualified = True
typehints_document_rtype = True
autoapi_python_class_content = "both" # Include both class and module docstrings in the output
autoapi_member_order = "groupwise" # Group members by class, functions, properties, etc.
myst_enable_extensions = [
"html_image", # Convert <img> tags in markdown files; https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#html-images
]
include_patterns = [
"docs/**",
"gigl/**",
"snapchat/**",
"snapchat/**",
"index.rst",
"examples/**",
]
autodoc_default_options = {
# Generate automatic documentation for all members of the target module
'members': True,
# Generate automatic documentation for members of the target module that don’t have a docstring or doc-comment
'undoc-members': True,
# Insert the class’s base classes after the class signature
'show-inheritance': True,
# Generate automatic documentation for special members of the target module
'special-members': '__init__',
# Exclude the given names from the members to document
'exclude-members': "__weakref__,__dict__,__module__,__class__,__abstractmethods__," +
# Also ignoring unhelpful members generated by protoc for protobuf classes
"DESCRIPTOR,KEY_FIELD_NUMBER,VALUE_FIELD_NUMBER,ClearField,ASSIGNER_ARGS_FIELD_NUMBER," +
"ASSIGNER_CLS_PATH_FIELD_NUMBER,assigner_cls_path,ExperimentalFlagsEntry",
}
# autodoc_typehints = "description"
templates_path = [
'gh_pages_source/_templates'
]
html_static_path = [
'gh_pages_source/_static',
]
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "pydata_sphinx_theme" # https://pydata-sphinx-theme.readthedocs.io/en/stable/
# Disable showing the rst source link - its not useful, neither is it asthetically pleasing.
# We enable the edit button instead so the src code can be seen and edited conveniently; see use of use_edit_page_button below.
html_show_sourcelink = False # https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/source-buttons.html#view-source-link
html_logo = "docs/assets/images/gigl.png"
html_favicon = "docs/assets/images/favicon.ico"
html_theme_options = {
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/header-links.html#icon-links
"icon_links": [
{
"name": "GitHub",
"url": "https://github.com/Snapchat/GiGL",
"icon": "fa-brands fa-github",
}
],
"logo": {
"text": "GiGL",
"image_dark": "docs/assets/images/gigl.png",
},
# Allow user to directly edit the documentation
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/source-buttons.html#add-an-edit-button
"use_edit_page_button": True,
# Configure secondary sidebar - remove right sidebar from example pages
"secondary_sidebar_items": {
"**": ["page-toc", "edit-this-page", "sourcelink"], # Default for all pages
"docs/api/**": ["page-toc", "sourcelink"], # Remove edit-this-page button from api pages, as they are auto-generated
},
}
# Allow user to directly edit the documentation
# https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/source-buttons.html#github
html_context = {
"github_user": "Snapchat",
"github_repo": "GiGL",
"github_version": "main",
"doc_path": "/",
}
nb_execution_mode = "off" # Disable execution of notebooks; we only want to render them as static content