grpclib

A pure-Python gRPC implementation for asyncio built on top of the hyper-h2 HTTP/2 stack.

Library
PyPI
v0.4.9
985stars
BSD 3-Clause License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
40/100Fair
Development Activity0
Maintenance0
Community72
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
81/100Excellent
Architecture86
Code Quality84
Innovation80
Learning Curve74

grpclib is a pure-Python implementation of gRPC designed specifically for asyncio. Rather than wrapping the C-based grpc library, it builds directly on the hyper-h2 HTTP/2 protocol stack, giving you native async/await client channels and servers with full support for unary and streaming RPCs.

Beyond the core client and server, grpclib ships batteries-included support for the gRPC ecosystem: server reflection, health checking, channelz, an events system for interceptor-style middleware, and a protoc plugin that generates asyncio-friendly stubs. It is a natural fit for asyncio microservices that need first-class gRPC without blocking calls.

What You Get

  • Async Channel client and Server primitives for unary and streaming RPCs
  • A protoc plugin that generates asyncio-native gRPC stubs
  • Built-in gRPC health checking, server reflection, and channelz support
  • An events system for implementing interceptor-style middleware
  • Testing utilities for exercising services without a real network

Common Use Cases

  • Building asyncio microservices that expose or consume gRPC APIs
  • Writing non-blocking gRPC clients inside async web services
  • Implementing streaming RPCs over HTTP/2 without the native grpc library
  • Adding health checks and reflection to Python gRPC services

Under The Hood

Architecture - The grpclib package separates concerns cleanly: client.py provides the Channel and typed stubs, server.py hosts the service handlers, and protocol.py/stream.py implement the HTTP/2 framing and streaming machinery on top of hyper-h2. Supporting subpackages add health, reflection, channelz, an encoding layer, an events middleware system, and a plugin package for the protoc code generator.

Tech Stack - Pure Python requiring 3.10+, built around h2 (hyper-h2) for the HTTP/2 protocol and protobuf for message serialization. It ships type information (py.typed) and integrates with the standard asyncio event loop rather than a bespoke runtime.

Code Quality - The project is well-tested, with a tests/ suite covering client channels, streaming, events, and server behavior, plus generated dummy protobuf fixtures. Type annotations, dedicated exception types, and a testing.py helper module indicate a mature, maintainable codebase, though recent development activity has slowed.

API Design - The API mirrors familiar gRPC concepts while embracing async idioms: async with Channel(host, port) as channel and await stub.Method(request) read naturally, and the protoc plugin generates stubs that match. Comprehensive documentation and an examples/ directory covering client, server, streaming, and interceptors keep onboarding straightforward for developers already familiar with gRPC and asyncio.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search