conf.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. # Configuration file for the Sphinx documentation builder.
  2. #
  3. # This file only contains a selection of the most common options. For a full
  4. # list see the documentation:
  5. # https://www.sphinx-doc.org/en/main/usage/configuration.html
  6. # -- Path setup --------------------------------------------------------------
  7. # If extensions (or modules to document with autodoc) are in another directory,
  8. # add these directories to sys.path here. If the directory is relative to the
  9. # documentation root, use os.path.abspath to make it absolute, like shown here.
  10. #
  11. import os
  12. import subprocess
  13. import sys
  14. import pytorch_sphinx_theme
  15. sys.path.insert(0, os.path.abspath('../..'))
  16. # -- Project information -----------------------------------------------------
  17. project = 'MMDetection'
  18. copyright = '2018-2021, OpenMMLab'
  19. author = 'MMDetection Authors'
  20. version_file = '../../mmdet/version.py'
  21. def get_version():
  22. with open(version_file, 'r') as f:
  23. exec(compile(f.read(), version_file, 'exec'))
  24. return locals()['__version__']
  25. # The full version, including alpha/beta/rc tags
  26. release = get_version()
  27. # -- General configuration ---------------------------------------------------
  28. # Add any Sphinx extension module names here, as strings. They can be
  29. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  30. # ones.
  31. extensions = [
  32. 'sphinx.ext.autodoc',
  33. 'sphinx.ext.napoleon',
  34. 'sphinx.ext.viewcode',
  35. 'myst_parser',
  36. 'sphinx_markdown_tables',
  37. 'sphinx_copybutton',
  38. ]
  39. myst_enable_extensions = ['colon_fence']
  40. myst_heading_anchors = 3
  41. autodoc_mock_imports = [
  42. 'matplotlib', 'pycocotools', 'terminaltables', 'mmdet.version', 'mmcv.ops'
  43. ]
  44. # Add any paths that contain templates here, relative to this directory.
  45. templates_path = ['_templates']
  46. # The suffix(es) of source filenames.
  47. # You can specify multiple suffix as a list of string:
  48. #
  49. source_suffix = {
  50. '.rst': 'restructuredtext',
  51. '.md': 'markdown',
  52. }
  53. # The main toctree document.
  54. master_doc = 'index'
  55. # List of patterns, relative to source directory, that match files and
  56. # directories to ignore when looking for source files.
  57. # This pattern also affects html_static_path and html_extra_path.
  58. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  59. # -- Options for HTML output -------------------------------------------------
  60. # The theme to use for HTML and HTML Help pages. See the documentation for
  61. # a list of builtin themes.
  62. #
  63. # html_theme = 'sphinx_rtd_theme'
  64. html_theme = 'pytorch_sphinx_theme'
  65. html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
  66. html_theme_options = {
  67. 'menu': [
  68. {
  69. 'name': 'GitHub',
  70. 'url': 'https://github.com/open-mmlab/mmdetection'
  71. },
  72. ],
  73. # Specify the language of shared menu
  74. 'menu_lang':
  75. 'en'
  76. }
  77. # Add any paths that contain custom static files (such as style sheets) here,
  78. # relative to this directory. They are copied after the builtin static files,
  79. # so a file named "default.css" will overwrite the builtin "default.css".
  80. html_static_path = ['_static']
  81. html_css_files = ['css/readthedocs.css']
  82. # -- Extension configuration -------------------------------------------------
  83. # Ignore >>> when copying code
  84. copybutton_prompt_text = r'>>> |\.\.\. '
  85. copybutton_prompt_is_regexp = True
  86. def builder_inited_handler(app):
  87. subprocess.run(['./stat.py'])
  88. def setup(app):
  89. app.connect('builder-inited', builder_inited_handler)