twirp
Twirp server and client lib
What it is and what it does
Twirp is a Python RPC framework that lets you define services in protobuf and automatically generate both server and client code. It implements the Twirp Wire Protocol v7, which is a lightweight alternative to gRPC that works over HTTP. The package provides an ASGI-compatible server wrapper (TwirpASGIApp) that you can run with uvicorn, plus client stubs that speak the Twirp protocol to remote services.
You define your service interface in a .proto file, run the protoc compiler with the twirpy plugin to generate Python code, then implement your service logic by subclassing the generated server class. The framework handles serialization, HTTP routing, and error handling. It depends on requests for HTTP calls, structlog for logging, and protobuf for message encoding.
Use it for:
- Build microservices that communicate via Twirp RPC instead of REST or gRPC.
- Generate type-safe client and server stubs from protobuf definitions with minimal boilerplate.
- Migrate from Twirp services in other languages to Python.
- Create lightweight RPC services that run on standard ASGI servers like uvicorn.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Twirp is a Python implementation of the Twirp RPC framework that generates server and client code from protobuf definitions, supporting Twirp Wire Protocol v7.
No—the package is abandoned (last release 2022-04-24) with no active maintenance. License status is unclear, and there is no guarantee of compatibility with current Python or protobuf versions. Use only if you are maintaining legacy code already using this package.
Install
twirp on PyPI
pip
pip install twirpuv
uv add twirppoetry
poetry add twirpInstalling twirp
Before you install
Low install friction with a pure-Python wheel. However, the package is abandoned—last release was 2022-04-24, over 1573 days ago. No recent maintenance or security updates are expected.
License in practice
License status is unclear; no SPDX identifier or raw license text is provided. Verify the actual license terms before using in a commercial or proprietary project.
Quickstart
pip install twirp
from twirp.asgi import TwirpASGIApp
from twirp.exceptions import InvalidArgument
class MyService:
def MyMethod(self, context, request):
return response
service_instance = MyService()
app = TwirpASGIApp()
app.add_service(service_instance)
Requires the protoc compiler and the protoc-gen-twirpy plugin (installed via Go). Also requires uvicorn to run the server.
Verify before relying
- Whether the protoc-gen-twirpy plugin is still available and functional.
- Current compatibility with modern Python versions and protobuf library versions.
- Whether abandoned status affects stability or security for production use.
Package facts
| License | not declared (unclear) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — requests, structlog, protobuf |
| Maintenance | abandoned — 1,573 days since the last release |
| First released | |
| Downloads | 1,086,330/month — #4,384 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: twirp-0.0.7-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
connect-pythonProvides Python client and server libraries for…
permissive · top 5,000 on PyPI
protoc-gen-connect-pythonA protoc plugin that generates Python client…
permissive · top 15,000 on PyPI
betterproto-fwGenerates idiomatic Python code from Protobuf 3…
permissive · top 15,000 on PyPI
aristaprotoGenerates Python gRPC stubs and message classes…
permissive · top 15,000 on PyPI
hatch-protobufA Hatch build plugin that generates Python…
copyleft · top 15,000 on PyPI
grpclibgrpclib is a pure-Python asyncio-based…
permissive · top 1,000 on PyPI
connectrpcConnect is a runtime library for building and…
permissive · top 15,000 on PyPI
grpc-gateway-protoc-gen-openapiv2Generates Python support code for gRPC Gateway…
permissive · top 15,000 on PyPI
betterproto-rust-codecProvides fast Rust-based conversion between…
permissive · top 15,000 on PyPI
protoc-gen-openapiv2Generates Python support code for gRPC Gateway…
permissive · top 5,000 on PyPI