conf.py 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. # Copyright 2018 The gRPC Authors
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. # -- Path setup --------------------------------------------------------------
  15. import os
  16. import sys
  17. PYTHON_FOLDER = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
  18. '..', '..', 'src', 'python')
  19. sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio'))
  20. sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_channelz'))
  21. sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_health_checking'))
  22. sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_reflection'))
  23. sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_status'))
  24. sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_testing'))
  25. # -- Project information -----------------------------------------------------
  26. project = 'gRPC Python'
  27. copyright = '2020, The gRPC Authors'
  28. author = 'The gRPC Authors'
  29. # Import generated grpc_version after the path been modified
  30. import grpc_version
  31. version = '.'.join(grpc_version.VERSION.split('.')[:3])
  32. release = grpc_version.VERSION
  33. if 'dev' in grpc_version.VERSION:
  34. branch = 'master'
  35. else:
  36. branch = 'v%s.%s.x' % tuple(grpc_version.VERSION.split('.')[:2])
  37. # -- General configuration ---------------------------------------------------
  38. templates_path = ['_templates']
  39. source_suffix = ['.rst', '.md']
  40. master_doc = 'index'
  41. language = 'en'
  42. exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
  43. pygments_style = None
  44. # --- Extensions Configuration -----------------------------------------------
  45. extensions = [
  46. 'sphinx.ext.autodoc',
  47. 'sphinx.ext.viewcode',
  48. 'sphinx.ext.todo',
  49. 'sphinx.ext.napoleon',
  50. 'sphinx.ext.coverage',
  51. 'sphinx.ext.autodoc.typehints',
  52. ]
  53. napoleon_google_docstring = True
  54. napoleon_numpy_docstring = True
  55. napoleon_include_special_with_doc = True
  56. autodoc_default_options = {
  57. 'members': None,
  58. }
  59. autodoc_mock_imports = []
  60. autodoc_typehints = 'description'
  61. # -- HTML Configuration -------------------------------------------------
  62. html_theme = 'alabaster'
  63. html_theme_options = {
  64. 'fixed_sidebar': True,
  65. 'page_width': '1140px',
  66. 'show_related': True,
  67. 'analytics_id': 'UA-60127042-1',
  68. 'description': grpc_version.VERSION,
  69. 'show_powered_by': False,
  70. }
  71. html_static_path = ["_static"]
  72. # -- Options for manual page output ------------------------------------------
  73. man_pages = [(master_doc, 'grpcio', 'grpcio Documentation', [author], 1)]
  74. # -- Options for Texinfo output ----------------------------------------------
  75. texinfo_documents = [
  76. (master_doc, 'grpcio', 'grpcio Documentation', author, 'grpcio',
  77. 'One line description of project.', 'Miscellaneous'),
  78. ]
  79. # -- Options for Epub output -------------------------------------------------
  80. epub_title = project
  81. epub_exclude_files = ['search.html']
  82. # -- Options for todo extension ----------------------------------------------
  83. todo_include_todos = True
  84. # -- Options for substitutions -----------------------------------------------
  85. rst_epilog = '.. |grpc_types_link| replace:: https://github.com/grpc/grpc/blob/%s/include/grpc/impl/codegen/grpc_types.h' % branch