conf.py 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. # Ensure we get the local copy of tornado instead of what's on the standard path
  8. import os
  9. import sys
  10. sys.path.insert(0, os.path.abspath(".."))
  11. sys.path.append(os.path.abspath("./_ext"))
  12. import pywebio
  13. version = release = pywebio.__version__
  14. # -- Project information -----------------------------------------------------
  15. project = 'PyWebIO'
  16. copyright = 'Weimin Wang'
  17. author = 'Weimin Wang'
  18. # -- General configuration ---------------------------------------------------
  19. # Add any Sphinx extension module names here, as strings. They can be
  20. # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
  21. # ones.
  22. extensions = [
  23. 'sphinx.ext.autodoc',
  24. # "sphinx.ext.intersphinx",
  25. "sphinx.ext.viewcode",
  26. 'sphinx_tabs.tabs',
  27. 'sphinx.ext.extlinks',
  28. 'codeblock', # defined in docs/_ext/codeblock.py
  29. 'sphinx_toolbox.collapse',
  30. ]
  31. primary_domain = "py"
  32. default_role = "py:obj"
  33. # intersphinx_mapping = {"python": ("https://docs.python.org/3.6/", None)}
  34. master_doc = 'index'
  35. autodoc_member_order = 'bysource'
  36. # The language for content autogenerated by Sphinx. Refer to documentation
  37. # for a list of supported languages.
  38. #
  39. # This is also used if you do content translation via gettext catalogs.
  40. # Usually you set "language" from the command line for these cases.
  41. language = 'en'
  42. gettext_additional_targets = ["literal-block"]
  43. # List of patterns, relative to source directory, that match files and
  44. # directories to ignore when looking for source files.
  45. # This pattern also affects html_static_path and html_extra_path.
  46. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  47. # -- Options for HTML output -------------------------------------------------
  48. # The theme to use for HTML and HTML Help pages. See the documentation for
  49. # a list of builtin themes.
  50. #
  51. html_theme = "sphinx_rtd_theme"
  52. # Add any paths that contain custom static files (such as style sheets) here,
  53. # relative to this directory. They are copied after the builtin static files,
  54. # so a file named "default.css" will overwrite the builtin "default.css".
  55. html_static_path = ['static']
  56. def setup(app):
  57. """Configure Sphinx"""
  58. app.add_css_file('pywebio.css')
  59. # -- Extension configuration -------------------------------------------------
  60. from demos import config
  61. extlinks = {
  62. 'demo_host': (config.demo_host + '%s', 'demo_host'),
  63. 'charts_demo_host': (config.charts_demo_host + '%s', 'charts_demo_host')
  64. }
  65. from sphinx.builders.html import StandaloneHTMLBuilder
  66. StandaloneHTMLBuilder.supported_image_types = [
  67. 'image/svg+xml',
  68. 'image/gif',
  69. 'image/png',
  70. 'image/jpeg'
  71. ]