|
| 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 = 'MMTracking' |
| 25 | +copyright = '2018-2021, OpenMMLab' |
| 26 | +author = 'MMTracking Authors' |
| 27 | +version_file = '../../mmtrack/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', |
| 46 | + 'sphinx.ext.napoleon', |
| 47 | + 'sphinx.ext.viewcode', |
| 48 | + 'recommonmark', |
| 49 | + 'sphinx_markdown_tables', |
| 50 | + 'sphinx_copybutton', |
| 51 | +] |
| 52 | + |
| 53 | +autodoc_mock_imports = [ |
| 54 | + 'matplotlib', 'pycocotools', 'terminaltables', 'mmtrack.version', |
| 55 | + 'seaborn', 'motmetrics', 'torchvision', 'pandas', 'scipy' |
| 56 | +] |
| 57 | + |
| 58 | +# Add any paths that contain templates here, relative to this directory. |
| 59 | +templates_path = ['_templates'] |
| 60 | + |
| 61 | +# The suffix(es) of source filenames. |
| 62 | +# You can specify multiple suffix as a list of string: |
| 63 | +# |
| 64 | +source_suffix = { |
| 65 | + '.rst': 'restructuredtext', |
| 66 | + '.md': 'markdown', |
| 67 | +} |
| 68 | + |
| 69 | +# The master toctree document. |
| 70 | +master_doc = 'index' |
| 71 | + |
| 72 | +# List of patterns, relative to source directory, that match files and |
| 73 | +# directories to ignore when looking for source files. |
| 74 | +# This pattern also affects html_static_path and html_extra_path. |
| 75 | +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
| 76 | + |
| 77 | +# -- Options for HTML output ------------------------------------------------- |
| 78 | + |
| 79 | +# The theme to use for HTML and HTML Help pages. See the documentation for |
| 80 | +# a list of builtin themes. |
| 81 | +# |
| 82 | +# html_theme = 'sphinx_rtd_theme' |
| 83 | +html_theme = 'pytorch_sphinx_theme' |
| 84 | +html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()] |
| 85 | + |
| 86 | +# Theme options are theme-specific and customize the look and feel of a theme |
| 87 | +# further. For a list of options available for each theme, see the |
| 88 | +# documentation. |
| 89 | +# |
| 90 | +html_theme_options = { |
| 91 | + # 'logo_url': 'https://mmtracking.readthedocs.io/en/latest/', |
| 92 | + 'menu': [ |
| 93 | + { |
| 94 | + 'name': 'GitHub', |
| 95 | + 'url': 'https://github.com/open-mmlab/mmtracking' |
| 96 | + }, |
| 97 | + { |
| 98 | + 'name': |
| 99 | + 'Upstream', |
| 100 | + 'children': [ |
| 101 | + { |
| 102 | + 'name': 'MMCV', |
| 103 | + 'url': 'https://github.com/open-mmlab/mmcv', |
| 104 | + }, |
| 105 | + { |
| 106 | + 'name': 'MMDetection', |
| 107 | + 'url': 'https://github.com/open-mmlab/mmdetection', |
| 108 | + }, |
| 109 | + ] |
| 110 | + }, |
| 111 | + ], |
| 112 | + # Specify the language of shared menu |
| 113 | + 'menu_lang': |
| 114 | + 'en' |
| 115 | +} |
| 116 | + |
| 117 | +# Add any paths that contain custom static files (such as style sheets) here, |
| 118 | +# relative to this directory. They are copied after the builtin static files, |
| 119 | +# so a file named "default.css" will overwrite the builtin "default.css". |
| 120 | +html_static_path = ['_static'] |
| 121 | +html_css_files = ['css/readthedocs.css'] |
| 122 | + |
| 123 | +language = 'en' |
| 124 | + |
| 125 | +# Enable ::: for my_st |
| 126 | +myst_enable_extensions = ['colon_fence'] |
| 127 | +myst_heading_anchors = 3 |
| 128 | + |
| 129 | + |
| 130 | +def builder_inited_handler(app): |
| 131 | + subprocess.run(['./stat.py']) |
| 132 | + |
| 133 | + |
| 134 | +def setup(app): |
| 135 | + app.connect('builder-inited', builder_inited_handler) |
0 commit comments