skillfed

twirp

Twirp server and client lib

twirp v0.0.7 1.1M downloads/30d#4,384 on PyPI
License unclear Abandoned released

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 twirp

uv

uv add twirp

poetry

poetry add twirp

Installing 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

twirp rpc framework pythonprotobuf rpc server clienttwirp protocol v7 implementationasgi rpc frameworktwirp code generation
rpc-frameworkprotobufasgi

More Application Frameworks packages