diff --git a/doc/python/sphinx/conf.py b/doc/python/sphinx/conf.py index 49e5ecb1dcd..c30204b51ff 100644 --- a/doc/python/sphinx/conf.py +++ b/doc/python/sphinx/conf.py @@ -28,13 +28,17 @@ sys.path.insert(0, os.path.join(PYTHON_FOLDER, 'grpcio_testing')) # -- Project information ----------------------------------------------------- project = 'gRPC Python' -copyright = '2018, The gRPC Authors' +copyright = '2020, The gRPC Authors' author = 'The gRPC Authors' # Import generated grpc_version after the path been modified import grpc_version -version = ".".join(grpc_version.VERSION.split(".")[:3]) +version = '.'.join(grpc_version.VERSION.split('.')[:3]) release = grpc_version.VERSION +if 'dev' in grpc_version.VERSION: + branch = 'master' +else: + branch = 'v%s.%s.x' % tuple(grpc_version.VERSION.split('.')[:2]) # -- General configuration --------------------------------------------------- @@ -54,6 +58,7 @@ extensions = [ 'sphinx.ext.napoleon', 'sphinx.ext.coverage', 'sphinx.ext.autodoc.typehints', + 'sphinx.ext.extlinks', ] napoleon_google_docstring = True @@ -100,3 +105,7 @@ epub_exclude_files = ['search.html'] # -- Options for todo extension ---------------------------------------------- todo_include_todos = True + +# -- Options for substitutions ----------------------------------------------- + +rst_epilog = '.. |grpc_types_link| replace:: https://github.com/grpc/grpc/blob/%s/include/grpc/impl/codegen/grpc_types.h' % branch diff --git a/doc/python/sphinx/glossary.rst b/doc/python/sphinx/glossary.rst index c96c9bba1ad..951eba728a3 100644 --- a/doc/python/sphinx/glossary.rst +++ b/doc/python/sphinx/glossary.rst @@ -44,7 +44,6 @@ Glossary A list of key-value pairs to configure the underlying gRPC Core channel or server object. Channel arguments are meant for advanced usages. Full list channel arguments can be found under the "grpc_arg_keys" section of - `grpc_types.h - `_ - header file. For example, if you want to disable TCP port reuse, you may - construct channel arguments like: ``options = (('grpc.so_reuseport', 0),)``. + "grpc_types.h" header file (|grpc_types_link|). For example, if you want to disable TCP port + reuse, you may construct channel arguments like: ``options = + (('grpc.so_reuseport', 0),)``.