conf.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 subprocess
  13. import sys
  14. import pytorch_sphinx_theme
  15. sys.path.insert(0, os.path.abspath('../..'))
  16. # -- Project information -----------------------------------------------------
  17. project = 'EasyFL'
  18. copyright = '2020-2022, EasyFL'
  19. author = 'EasyFL Authors'
  20. version_file = '../../easyfl/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. 'recommonmark',
  36. 'sphinx_markdown_tables',
  37. 'sphinx_copybutton',
  38. ]
  39. autodoc_mock_imports = [
  40. 'matplotlib', 'pycocotools', 'terminaltables', 'mmdet.version', 'mmcv.ops'
  41. ]
  42. # Add any paths that contain templates here, relative to this directory.
  43. templates_path = ['_templates']
  44. # The suffix(es) of source filenames.
  45. # You can specify multiple suffix as a list of string:
  46. #
  47. source_suffix = {
  48. '.rst': 'restructuredtext',
  49. '.md': 'markdown',
  50. }
  51. # The master toctree document.
  52. master_doc = 'index'
  53. # List of patterns, relative to source directory, that match files and
  54. # directories to ignore when looking for source files.
  55. # This pattern also affects html_static_path and html_extra_path.
  56. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  57. # -- Options for HTML output -------------------------------------------------
  58. # The theme to use for HTML and HTML Help pages. See the documentation for
  59. # a list of builtin themes.
  60. #
  61. # html_theme = 'sphinx_rtd_theme'
  62. html_theme = 'pytorch_sphinx_theme'
  63. html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
  64. html_theme_options = {
  65. 'menu': [
  66. {
  67. 'name': 'Get Started',
  68. 'url': 'get_started.html'
  69. },
  70. {
  71. 'name': 'Tutorials',
  72. 'url': 'tutorials/high-level_apis.html'
  73. },
  74. {
  75. 'name': 'API',
  76. 'url': 'api.html'
  77. },
  78. {
  79. 'name': 'GitHub',
  80. 'url': 'https://github.com/EasyFL-AI/easyfl'
  81. },
  82. ],
  83. # Specify the language of shared menu
  84. 'menu_lang': 'en'
  85. }
  86. # Add any paths that contain custom static files (such as style sheets) here,
  87. # relative to this directory. They are copied after the builtin static files,
  88. # so a file named "default.css" will overwrite the builtin "default.css".
  89. html_static_path = ['_static']
  90. html_css_files = ['css/readthedocs.css']
  91. # -- Extension configuration -------------------------------------------------
  92. # Ignore >>> when copying code
  93. copybutton_prompt_text = r'>>> |\.\.\. '
  94. copybutton_prompt_is_regexp = True
  95. # def builder_inited_handler(app):
  96. # subprocess.run(['./stat.py'])
  97. # def setup(app):
  98. # app.connect('builder-inited', builder_inited_handler)