|
a |
|
b/docs/conf.py |
|
|
1 |
# Copyright (c) OpenMMLab. All rights reserved. |
|
|
2 |
# Configuration file for the Sphinx documentation builder. |
|
|
3 |
# |
|
|
4 |
# This file only contains a selection of the most common options. For a full |
|
|
5 |
# list see the documentation: |
|
|
6 |
# https://www.sphinx-doc.org/en/master/usage/configuration.html |
|
|
7 |
|
|
|
8 |
# -- Path setup -------------------------------------------------------------- |
|
|
9 |
|
|
|
10 |
# If extensions (or modules to document with autodoc) are in another directory, |
|
|
11 |
# add these directories to sys.path here. If the directory is relative to the |
|
|
12 |
# documentation root, use os.path.abspath to make it absolute, like shown here. |
|
|
13 |
# |
|
|
14 |
import os |
|
|
15 |
import subprocess |
|
|
16 |
import sys |
|
|
17 |
|
|
|
18 |
import pytorch_sphinx_theme |
|
|
19 |
|
|
|
20 |
sys.path.insert(0, os.path.abspath('..')) |
|
|
21 |
|
|
|
22 |
# -- Project information ----------------------------------------------------- |
|
|
23 |
|
|
|
24 |
project = 'MMAction2' |
|
|
25 |
copyright = '2020, OpenMMLab' |
|
|
26 |
author = 'MMAction2 Authors' |
|
|
27 |
version_file = '../mmaction/version.py' |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
def get_version(): |
|
|
31 |
with open(version_file, 'r') as f: |
|
|
32 |
exec(compile(f.read(), version_file, 'exec')) |
|
|
33 |
return locals()['__version__'] |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
# The full version, including alpha/beta/rc tags |
|
|
37 |
release = get_version() |
|
|
38 |
|
|
|
39 |
# -- General configuration --------------------------------------------------- |
|
|
40 |
|
|
|
41 |
# Add any Sphinx extension module names here, as strings. They can be |
|
|
42 |
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
|
|
43 |
# ones. |
|
|
44 |
extensions = [ |
|
|
45 |
'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', |
|
|
46 |
'sphinx_markdown_tables', 'sphinx_copybutton', 'myst_parser' |
|
|
47 |
] |
|
|
48 |
|
|
|
49 |
# numpy and torch are required |
|
|
50 |
autodoc_mock_imports = ['mmaction.version', 'PIL'] |
|
|
51 |
|
|
|
52 |
copybutton_prompt_text = r'>>> |\.\.\. ' |
|
|
53 |
copybutton_prompt_is_regexp = True |
|
|
54 |
|
|
|
55 |
# Add any paths that contain templates here, relative to this directory. |
|
|
56 |
templates_path = ['_templates'] |
|
|
57 |
|
|
|
58 |
# List of patterns, relative to source directory, that match files and |
|
|
59 |
# directories to ignore when looking for source files. |
|
|
60 |
# This pattern also affects html_static_path and html_extra_path. |
|
|
61 |
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
|
|
62 |
|
|
|
63 |
# -- Options for HTML output ------------------------------------------------- |
|
|
64 |
source_suffix = {'.rst': 'restructuredtext', '.md': 'markdown'} |
|
|
65 |
|
|
|
66 |
# The theme to use for HTML and HTML Help pages. See the documentation for |
|
|
67 |
# a list of builtin themes. |
|
|
68 |
# |
|
|
69 |
html_theme = 'pytorch_sphinx_theme' |
|
|
70 |
|
|
|
71 |
# Add any paths that contain custom static files (such as style sheets) here, |
|
|
72 |
# relative to this directory. They are copied after the builtin static files, |
|
|
73 |
# so a file named "default.css" will overwrite the builtin "default.css". |
|
|
74 |
|
|
|
75 |
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()] |
|
|
76 |
html_theme_options = { |
|
|
77 |
# 'logo_url': 'https://mmaction2.readthedocs.io/en/latest/', |
|
|
78 |
'menu': [ |
|
|
79 |
{ |
|
|
80 |
'name': |
|
|
81 |
'Tutorial', |
|
|
82 |
'url': |
|
|
83 |
'https://colab.research.google.com/github/' |
|
|
84 |
'open-mmlab/mmaction2/blob/master/demo/mmaction2_tutorial.ipynb' |
|
|
85 |
}, |
|
|
86 |
{ |
|
|
87 |
'name': 'GitHub', |
|
|
88 |
'url': 'https://github.com/open-mmlab/mmaction2' |
|
|
89 |
}, |
|
|
90 |
{ |
|
|
91 |
'name': |
|
|
92 |
'Upstream', |
|
|
93 |
'children': [ |
|
|
94 |
{ |
|
|
95 |
'name': 'MMCV', |
|
|
96 |
'url': 'https://github.com/open-mmlab/mmcv', |
|
|
97 |
'description': 'Foundational library for computer vision' |
|
|
98 |
}, |
|
|
99 |
{ |
|
|
100 |
'name': |
|
|
101 |
'MMClassification', |
|
|
102 |
'url': |
|
|
103 |
'https://github.com/open-mmlab/mmclassification', |
|
|
104 |
'description': |
|
|
105 |
'Open source image classification toolbox based on PyTorch' |
|
|
106 |
}, |
|
|
107 |
{ |
|
|
108 |
'name': 'MMDetection', |
|
|
109 |
'url': 'https://github.com/open-mmlab/mmdetection', |
|
|
110 |
'description': 'Object detection toolbox and benchmark' |
|
|
111 |
}, |
|
|
112 |
] |
|
|
113 |
}, |
|
|
114 |
], |
|
|
115 |
# Specify the language of shared menu |
|
|
116 |
'menu_lang': |
|
|
117 |
'en' |
|
|
118 |
} |
|
|
119 |
|
|
|
120 |
language = 'en' |
|
|
121 |
master_doc = 'index' |
|
|
122 |
|
|
|
123 |
html_static_path = ['_static'] |
|
|
124 |
html_css_files = ['css/readthedocs.css'] |
|
|
125 |
|
|
|
126 |
myst_enable_extensions = ['colon_fence'] |
|
|
127 |
|
|
|
128 |
|
|
|
129 |
def builder_inited_handler(app): |
|
|
130 |
subprocess.run(['./merge_docs.sh']) |
|
|
131 |
subprocess.run(['./stat.py']) |
|
|
132 |
|
|
|
133 |
|
|
|
134 |
def setup(app): |
|
|
135 |
app.connect('builder-inited', builder_inited_handler) |