conf.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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/master/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 sys
  13. # The theme to use for HTML and HTML Help pages. See the documentation for
  14. # a list of builtin themes.
  15. #
  16. import pytorch_sphinx_theme
  17. sys.path.insert(0, os.path.abspath('../..'))
  18. # -- Project information -----------------------------------------------------
  19. project = 'mim'
  20. copyright = '2021, openmmlab'
  21. author = 'MIM Authors'
  22. version_file = '../../mim/version.py'
  23. def get_version():
  24. with open(version_file) as f:
  25. exec(compile(f.read(), version_file, 'exec'))
  26. return locals()['__version__']
  27. # The full version, including alpha/beta/rc tags
  28. version = get_version()
  29. release = get_version()
  30. # -- General configuration ---------------------------------------------------
  31. # Add any Sphinx extension module names here, as strings. They can be
  32. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  33. # ones.
  34. extensions = [
  35. 'sphinx.ext.autodoc',
  36. 'sphinx.ext.napoleon',
  37. 'sphinx.ext.viewcode',
  38. 'sphinx_markdown_tables',
  39. 'myst_parser',
  40. 'sphinx_copybutton',
  41. ] # yapf: disable
  42. # Add any paths that contain templates here, relative to this directory.
  43. templates_path = ['_templates']
  44. # List of patterns, relative to source directory, that match files and
  45. # directories to ignore when looking for source files.
  46. # This pattern also affects html_static_path and html_extra_path.
  47. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  48. # The name of the Pygments (syntax highlighting) style to use.
  49. pygments_style = 'sphinx'
  50. # -- Options for HTML output -------------------------------------------------
  51. html_theme = 'pytorch_sphinx_theme'
  52. html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
  53. html_theme_options = {
  54. 'menu': [
  55. {
  56. 'name': 'GitHub',
  57. 'url': 'https://github.com/open-mmlab/mim'
  58. },
  59. ],
  60. # Specify the language of shared menu
  61. 'menu_lang': 'en',
  62. }
  63. # Add any paths that contain custom static files (such as style sheets) here,
  64. # relative to this directory. They are copied after the builtin static files,
  65. # so a file named "default.css" will overwrite the builtin "default.css".
  66. html_static_path = ['_static']
  67. # -- Extension configuration -------------------------------------------------
  68. # Ignore >>> when copying code
  69. copybutton_prompt_text = r'>>> |\.\.\. '
  70. copybutton_prompt_is_regexp = True