This library provides high-quality type stubs for the `grpcio` Python library, enabling static type checkers like MyPy to understand gRPC-related code. It's part of the `typeshed` project. The current version is 1.0.0.20260408, with releases typically following updates from the main `grpcio` library or the broader `typeshed` project, often on a monthly or bi-monthly basis.
pip install types-grpcioVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how `types-grpcio` enables static type checking for common `grpcio` operations, ensuring type correctness during development. It shows the basic usage of `grpc.insecure_channel` and explains how type checkers benefit from the installed stubs.
Ensure both `grpcio` and `types-grpcio` are installed: `pip install grpcio types-grpcio`.
Keep `types-grpcio` updated, ideally in sync with your `grpcio` installation. `types-grpcio` versions often include a date stamp (e.g., `1.0.0.20260408`) to indicate when they were generated against a specific `grpcio` version or typeshed state.
Consult the `mypy-protobuf` documentation or `mypy`'s documentation for correctly type checking custom generated gRPC code.