You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

conf.py 4.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. import shutil
  14. import subprocess
  15. import sphinx_rtd_theme
  16. try:
  17. import m2r2
  18. except ModuleNotFoundError:
  19. subprocess.check_call([sys.executable, "-m", "pip", "install", "m2r2"])
  20. try:
  21. import autoapi
  22. except ModuleNotFoundError:
  23. subprocess.check_call([sys.executable, "-m", "pip",
  24. "install", "sphinx-autoapi"])
  25. _base_path = os.path.abspath('..')
  26. sys.path.append(os.path.join(_base_path, "lib"))
  27. sys.path.append(_base_path)
  28. extra_paths = [
  29. os.path.join(_base_path, "examples"),
  30. ]
  31. for p in extra_paths:
  32. dst = os.path.join(
  33. _base_path, "docs",
  34. os.path.basename(p)
  35. )
  36. if os.path.isfile(dst):
  37. os.remove(dst)
  38. elif os.path.isdir(dst):
  39. shutil.rmtree(dst)
  40. if os.path.isdir(p):
  41. shutil.copytree(p, dst)
  42. else:
  43. shutil.copy2(p, dst)
  44. with open('../lib/sedna/VERSION', "r", encoding="utf-8") as fh:
  45. __version__ = fh.read().strip()
  46. # -- Project information -----------------------------------------------------
  47. project = 'Sedna'
  48. copyright = '2020, Kubeedge'
  49. author = 'Kubeedge'
  50. version = __version__
  51. release = __version__
  52. # -- General configuration ---------------------------------------------------
  53. # Add any Sphinx extension module names here, as strings. They can be
  54. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  55. # ones.
  56. extensions = [
  57. "m2r2",
  58. "sphinx.ext.autodoc",
  59. "sphinx.ext.todo",
  60. "sphinx.ext.coverage",
  61. "sphinx.ext.viewcode",
  62. "autoapi.extension",
  63. "sphinx.ext.intersphinx",
  64. "sphinx.ext.autosummary",
  65. "sphinx.ext.napoleon"
  66. ]
  67. autodoc_inherit_docstrings = False
  68. autodoc_member_order = "bysource"
  69. # If true, `todo` and `todoList` produce output, else they produce nothing.
  70. todo_include_todos = True
  71. # Add any paths that contain templates here, relative to this directory.
  72. # templates_path = ['_templates']
  73. # List of patterns, relative to source directory, that match files and
  74. # directories to ignore when looking for source files.
  75. # This pattern also affects html_static_path and html_extra_path.
  76. exclude_patterns = []
  77. # The master toctree document
  78. master_doc = 'index'
  79. # The name of the Pygments (syntax highlighting) style to use.
  80. pygments_style = 'sphinx'
  81. html_static_path = ['_static']
  82. # -- Options for HTML output -------------------------------------------------
  83. # The theme to use for HTML and HTML Help pages. See the documentation for
  84. # a list of builtin themes.
  85. #
  86. html_theme = 'sphinx_rtd_theme'
  87. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
  88. html_last_updated_fmt = "%b %d, %Y"
  89. html_theme_options = {
  90. 'prev_next_buttons_location': 'both'
  91. }
  92. # Add any paths that contain custom static files (such as style sheets) here,
  93. # relative to this directory. They are copied after the builtin static files,
  94. # so a file named "default.css" will overwrite the builtin "default.css".
  95. # html_static_path = ['_static']
  96. source_suffix = {
  97. '.rst': 'restructuredtext',
  98. '.txt': 'markdown',
  99. '.md': 'markdown',
  100. }
  101. autoapi_type = "python"
  102. autoapi_dirs = ["../lib/sedna"]
  103. autoapi_options = ['members', 'undoc-members', 'show-inheritance', 'show-module-summary', 'special-members', 'imported-members']
  104. extlinks = {
  105. "issue": ("https://github.com/kubeedge/sedna/issues/%s", "#"),
  106. "pr": ("https://github.com/kubeedge/sedna/pull/%s", "PR #"),
  107. }
  108. def setup(app):
  109. app.add_css_file('css/custom.css')