Functions | Variables
grpc._runtime_protos Namespace Reference

Functions

def _call_with_lazy_import (fn_name, protobuf_path)
 
def _has_runtime_proto_symbols (mod)
 
def _is_grpc_tools_importable ()
 
def protos (protobuf_path)
 
def protos_and_services (protobuf_path)
 
def services (protobuf_path)
 

Variables

tuple _MINIMUM_VERSION = (3, 5, 0)
 
tuple _REQUIRED_SYMBOLS = ("_protos", "_services", "_protos_and_services")
 
string _UNINSTALLED_TEMPLATE = "Install the grpcio-tools package (1.32.0+) to use the {} function."
 
string _VERSION_ERROR_TEMPLATE = "The {} function is only on available on Python 3.X interpreters."
 

Function Documentation

◆ _call_with_lazy_import()

def grpc._runtime_protos._call_with_lazy_import (   fn_name,
  protobuf_path 
)
private
Calls one of the three functions, lazily importing grpc_tools.

Args:
  fn_name: The name of the function to import from grpc_tools.protoc.
  protobuf_path: The path to import.

Returns:
  The appropriate module object.

Definition at line 40 of file _runtime_protos.py.

◆ _has_runtime_proto_symbols()

def grpc._runtime_protos._has_runtime_proto_symbols (   mod)
private

Definition at line 24 of file _runtime_protos.py.

◆ _is_grpc_tools_importable()

def grpc._runtime_protos._is_grpc_tools_importable ( )
private

Definition at line 28 of file _runtime_protos.py.

◆ protos()

def grpc._runtime_protos.protos (   protobuf_path)
Returns a module generated by the indicated .proto file.

THIS IS AN EXPERIMENTAL API.

Use this function to retrieve classes corresponding to message
definitions in the .proto file.

To inspect the contents of the returned module, use the dir function.
For example:

```
protos = grpc.protos("foo.proto")
print(dir(protos))
```

The returned module object corresponds to the _pb2.py file generated
by protoc. The path is expected to be relative to an entry on sys.path
and all transitive dependencies of the file should also be resolveable
from an entry on sys.path.

To completely disable the machinery behind this function, set the
GRPC_PYTHON_DISABLE_DYNAMIC_STUBS environment variable to "true".

Args:
  protobuf_path: The path to the .proto file on the filesystem. This path
    must be resolveable from an entry on sys.path and so must all of its
    transitive dependencies.

Returns:
  A module object corresponding to the message code for the indicated
  .proto file. Equivalent to a generated _pb2.py file.

Definition at line 63 of file _runtime_protos.py.

◆ protos_and_services()

def grpc._runtime_protos.protos_and_services (   protobuf_path)
Returns a 2-tuple of modules corresponding to protos and services.

THIS IS AN EXPERIMENTAL API.

The return value of this function is equivalent to a call to protos and a
call to services.

To completely disable the machinery behind this function, set the
GRPC_PYTHON_DISABLE_DYNAMIC_STUBS environment variable to "true".

Args:
  protobuf_path: The path to the .proto file on the filesystem. This path
    must be resolveable from an entry on sys.path and so must all of its
    transitive dependencies.

Returns:
  A 2-tuple of module objects corresponding to (protos(path), services(path)).

Definition at line 136 of file _runtime_protos.py.

◆ services()

def grpc._runtime_protos.services (   protobuf_path)
Returns a module generated by the indicated .proto file.

THIS IS AN EXPERIMENTAL API.

Use this function to retrieve classes and functions corresponding to
service definitions in the .proto file, including both stub and servicer
definitions.

To inspect the contents of the returned module, use the dir function.
For example:

```
services = grpc.services("foo.proto")
print(dir(services))
```

The returned module object corresponds to the _pb2_grpc.py file generated
by protoc. The path is expected to be relative to an entry on sys.path
and all transitive dependencies of the file should also be resolveable
from an entry on sys.path.

To completely disable the machinery behind this function, set the
GRPC_PYTHON_DISABLE_DYNAMIC_STUBS environment variable to "true".

Args:
  protobuf_path: The path to the .proto file on the filesystem. This path
    must be resolveable from an entry on sys.path and so must all of its
    transitive dependencies.

Returns:
  A module object corresponding to the stub/service code for the indicated
  .proto file. Equivalent to a generated _pb2_grpc.py file.

Definition at line 99 of file _runtime_protos.py.

Variable Documentation

◆ _MINIMUM_VERSION

tuple grpc._runtime_protos._MINIMUM_VERSION = (3, 5, 0)
private

Definition at line 18 of file _runtime_protos.py.

◆ _REQUIRED_SYMBOLS

tuple grpc._runtime_protos._REQUIRED_SYMBOLS = ("_protos", "_services", "_protos_and_services")
private

Definition at line 17 of file _runtime_protos.py.

◆ _UNINSTALLED_TEMPLATE

string grpc._runtime_protos._UNINSTALLED_TEMPLATE = "Install the grpcio-tools package (1.32.0+) to use the {} function."
private

Definition at line 20 of file _runtime_protos.py.

◆ _VERSION_ERROR_TEMPLATE

string grpc._runtime_protos._VERSION_ERROR_TEMPLATE = "The {} function is only on available on Python 3.X interpreters."
private

Definition at line 21 of file _runtime_protos.py.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:32