--- id: betterproto version: "1.2.5" license: MIT license_treatment: permissive maintenance: aging --- # betterproto — A better Protobuf / gRPC generator & library License: permissive · Maintenance: aging · Downloads: 3.6M/mo ## What it is and what it does Betterproto is a code generator and runtime library that converts Protobuf 3 and gRPC service definitions into readable, idiomatic Python code. It addresses limitations in the official Google Protobuf Python plugin by generating dataclasses with type hints, async/await support, and modern Python conventions instead of the verbose, non-idiomatic code the official plugin produces. The generated messages support both binary and JSON serialization, timezone-aware datetime objects, and work with mypy for static type checking. You install the package in two modes: with the `[compiler]` extra to get the protoc plugin for code generation, or without it to only use the runtime library for deserializing messages. Once generated, your Protobuf messages become standard Python dataclasses that feel native to the language, with methods like `to_json()`, `to_dict()`, and `parse()` rather than the camelCase method names of the official library. Use it for: - Generate gRPC service stubs with async/await support for building high-concurrency microservices - Convert Protobuf definitions to typed Python dataclasses for IDE autocomplete and mypy validation - Serialize and deserialize messages to/from JSON with configurable field naming (camelCase or snake_case) - Build APIs where Protobuf messages integrate naturally with modern Python async frameworks - Replace the official Google Protobuf plugin when its generated code is unreadable or import paths break ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates idiomatic Python code from Protobuf 3 and gRPC definitions, with built-in async support, JSON serialization, and modern type hints. Yes, if you are committed to Protobuf 3 and value idiomatic, readable generated code with async support—but with caution. The package has not shipped a release since 2020-05-27 despite recent repository commits, signaling stalled maintenance at the release level. It remains suitable for new projects or teams already using it, but consider the risk of unpatched issues and incompatibility with future Protobuf or gRPC versions. No known security vulnerabilities. ## Install pip install betterproto uv add betterproto poetry add betterproto ## Installing betterproto Before you install: High install friction due to compiler dependencies. The package has not seen a release since 2020-05-27 despite repository activity through 2025-07-17, indicating maintenance has stalled at the release level. Suitable for projects already committed to Protobuf 3 and willing to manage aging tooling. License in practice: MIT license permits commercial and private use with minimal restrictions, making it safe for most projects from a licensing standpoint. Quickstart: # Install with compiler support pip install "betterproto[compiler]" # Generate from proto file protoc -I . --python_betterproto_out=. example.proto # Use generated code import betterproto @dataclass class Message(betterproto.Message): value: str = betterproto.string_field(1) test = Message(value="example") serialized = bytes(test) another = Message().parse(serialized) Requires protoc (Protocol Buffer compiler) installed on the system; Python 3.6 or later. Verify before relying: - Current compatibility with Protobuf 3 versions released after 2020-05-27 - Whether async gRPC support works with current grpclib versions - Active maintenance status given no releases in nearly 6 years despite recent commits ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: high - Maintenance: aging - Downloads: 3.6M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags protobuf code generation python, grpc async python, protobuf to python dataclass, modern protobuf python, grpc stub generation, protobuf json serialization, python protobuf compiler, protobuf-codegen, grpc-async, dataclass-generation [View on SkillFed](https://skillfed.io/packages/betterproto) · [View on PyPI](https://pypi.org/project/betterproto/)