xref: /aosp_15_r20/external/grpc-grpc/doc/python/sphinx/conf.py (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
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
15# -- Path setup --------------------------------------------------------------
16
17import os
18import sys
19PYTHON_FOLDER = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..',
20                             '..', '..', 'src', 'python')
21sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio'))
22sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_channelz'))
23sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_health_checking'))
24sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_reflection'))
25sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_status'))
26sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_testing'))
27
28# -- Project information -----------------------------------------------------
29
30project = 'gRPC Python'
31copyright = '2020, The gRPC Authors'
32author = 'The gRPC Authors'
33
34# Import generated grpc_version after the path been modified
35import grpc_version
36version = '.'.join(grpc_version.VERSION.split('.')[:3])
37release = grpc_version.VERSION
38if 'dev' in grpc_version.VERSION:
39    branch = 'master'
40else:
41    branch = 'v%s.%s.x' % tuple(grpc_version.VERSION.split('.')[:2])
42
43# -- General configuration ---------------------------------------------------
44
45templates_path = ['_templates']
46source_suffix = ['.rst', '.md']
47master_doc = 'index'
48language = 'en'
49exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
50pygments_style = None
51
52# --- Extensions Configuration -----------------------------------------------
53
54extensions = [
55    'sphinx.ext.autodoc',
56    'sphinx.ext.viewcode',
57    'sphinx.ext.todo',
58    'sphinx.ext.napoleon',
59    'sphinx.ext.coverage',
60    'sphinx.ext.autodoc.typehints',
61]
62
63napoleon_google_docstring = True
64napoleon_numpy_docstring = True
65napoleon_include_special_with_doc = True
66
67autodoc_default_options = {
68    'members': None,
69}
70
71autodoc_mock_imports = ["envoy"]
72
73autodoc_typehints = 'description'
74
75# -- HTML Configuration -------------------------------------------------
76
77html_theme = 'alabaster'
78html_theme_options = {
79    'fixed_sidebar': True,
80    'page_width': '1140px',
81    'show_related': True,
82    'analytics_id': 'UA-60127042-1',
83    'description': grpc_version.VERSION,
84    'show_powered_by': False,
85}
86html_static_path = ["_static"]
87
88# -- Options for manual page output ------------------------------------------
89
90man_pages = [(master_doc, 'grpcio', 'grpcio Documentation', [author], 1)]
91
92# -- Options for Texinfo output ----------------------------------------------
93
94texinfo_documents = [
95    (master_doc, 'grpcio', 'grpcio Documentation', author, 'grpcio',
96     'One line description of project.', 'Miscellaneous'),
97]
98
99# -- Options for Epub output -------------------------------------------------
100
101epub_title = project
102epub_exclude_files = ['search.html']
103
104# -- Options for todo extension ----------------------------------------------
105
106todo_include_todos = True
107
108# -- Options for substitutions -----------------------------------------------
109
110rst_epilog = '.. |channel_arg_names_link| replace:: https://github.com/grpc/grpc/blob/%s/include/grpc/impl/channel_arg_names.h' % branch
111