types-grpcio-reflection

raw JSON →
1.0.0.20260408 verified Mon Apr 27 auth: no python

Typing stubs for the grpcio-reflection package, provided by typeshed. Version 1.0.0.20260408 corresponds to stubs for grpcio-reflection with Python >=3.10. Updated automatically alongside typeshed; no fixed release cadence.

pip install types-grpcio-reflection
error ImportError: cannot import name 'ProtoReflectionDescriptorDatabase' from 'grpc_reflection.v1alpha'
cause The stub exports types, but the actual runtime class may be located in a submodule. Direct import of internal symbols can fail.
fix
Import from the top-level module: 'from grpc_reflection.v1alpha import reflection' and access classes via reflection.
error TypeError: 'module' object is not callable
cause Trying to call the module itself instead of a function within it. E.g., 'grpc_reflection.v1alpha()' instead of 'grpc_reflection.v1alpha.reflection.enable_server_reflection()'.
fix
Access the correct function or class from the module: 'from grpc_reflection.v1alpha import reflection; reflection.enable_server_reflection(...)'
gotcha This is a stub package providing type hints only. It does not include the runtime implementation. You must still install 'grpcio-reflection' separately.
fix Run 'pip install grpcio-reflection' alongside this stubs package.
deprecated The v1alpha reflection API is deprecated in newer versions of grpcio-reflection; prefer v1.
fix Use 'grpc_reflection.v1' instead of 'grpc_reflection.v1alpha' where possible.

Basic usage enabling reflection on a gRPC server. Ensure grpcio-reflection is installed.

from grpc_reflection.v1alpha import reflection
import grpc

# Example: enabling reflection on a server
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
reflection.enable_server_reflection(service_names, server)
server.start()