conf.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. # -- Path setup --------------------------------------------------------------
  8. # If extensions (or modules to document with autodoc) are in another directory,
  9. # add these directories to sys.path here. If the directory is relative to the
  10. # documentation root, use os.path.abspath to make it absolute, like shown here.
  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 = 'MMPose'
  18. copyright = '2020-2021, OpenMMLab'
  19. author = 'MMPose Authors'
  20. # The full version, including alpha/beta/rc tags
  21. version_file = '../../mmpose/version.py'
  22. def get_version():
  23. with open(version_file, 'r') as f:
  24. exec(compile(f.read(), version_file, 'exec'))
  25. return locals()['__version__']
  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', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode',
  33. 'sphinx_markdown_tables', 'sphinx_copybutton', 'myst_parser',
  34. 'sphinx.ext.autosummary'
  35. ]
  36. autodoc_mock_imports = ['json_tricks', 'mmpose.version']
  37. # Ignore >>> when copying code
  38. copybutton_prompt_text = r'>>> |\.\.\. '
  39. copybutton_prompt_is_regexp = True
  40. # Add any paths that contain templates here, relative to this directory.
  41. templates_path = ['_templates']
  42. # List of patterns, relative to source directory, that match files and
  43. # directories to ignore when looking for source files.
  44. # This pattern also affects html_static_path and html_extra_path.
  45. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  46. # -- Options for HTML output -------------------------------------------------
  47. source_suffix = {
  48. '.rst': 'restructuredtext',
  49. '.md': 'markdown',
  50. }
  51. # The theme to use for HTML and HTML Help pages. See the documentation for
  52. # a list of builtin themes.
  53. #
  54. html_theme = 'pytorch_sphinx_theme'
  55. html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
  56. html_theme_options = {
  57. 'menu': [
  58. {
  59. 'name': 'GitHub',
  60. 'url': 'https://github.com/open-mmlab/mmpose/tree/main'
  61. },
  62. ],
  63. # Specify the language of the shared menu
  64. 'menu_lang':
  65. 'en'
  66. }
  67. # Add any paths that contain custom static files (such as style sheets) here,
  68. # relative to this directory. They are copied after the builtin static files,
  69. # so a file named "default.css" will overwrite the builtin "default.css".
  70. language = 'en'
  71. html_static_path = ['_static']
  72. html_css_files = ['css/readthedocs.css']
  73. # Enable ::: for my_st
  74. myst_enable_extensions = ['colon_fence']
  75. master_doc = 'index'
  76. def builder_inited_handler(app):
  77. subprocess.run(['python', './collect_modelzoo.py'])
  78. subprocess.run(['python', './collect_projects.py'])
  79. subprocess.run(['sh', './merge_docs.sh'])
  80. subprocess.run(['python', './stats.py'])
  81. def setup(app):
  82. app.connect('builder-inited', builder_inited_handler)