--- id: betterproto2-compiler version: "0.10.1" license: MIT license_treatment: permissive maintenance: active --- # betterproto2-compiler — Compiler for betterproto2 License: permissive · Maintenance: active · Downloads: 119.2K/mo ## What it is and what it does betterproto2-compiler is a code generator that transforms Protobuf 3 and gRPC definitions into readable, idiomatic Python code. It reimplements Google's protoc plugin from the ground up, prioritizing modern Python idioms—dataclasses, async/await, type hints, and built-in datetime objects—over legacy patterns. The generated code includes both binary and JSON serialization, supports Pydantic model generation, and produces importable modules with proper `__init__.py` files. The package addresses long-standing limitations of the official protoc plugin: it adds native async support, full type checking and IDE completion, relative imports that work in Python 3, and avoids name-collision bugs. While the wire format remains compatible with standard Protobuf, the generated API differs—using Pythonic method names and patterns instead of capitalized functions like `HasField()` or `SerializeToString()`. The project is actively developed but explicitly subject to breaking changes, and documentation is incomplete. Use it for: - Generate async gRPC service stubs and client code without requiring additional plugins or manual async wrapping. - Create type-hinted, IDE-friendly Python dataclasses from Protobuf schemas for better developer experience and static analysis. - Build Pydantic-compatible models directly from Protobuf definitions for validation and serialization workflows. - Modernize Protobuf-based Python projects by replacing Google's protoc plugin with idiomatic, readable generated code. - Develop microservices that use Protobuf for serialization while leveraging Python's async/await and modern language features. ## 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/await support, type hints, and modern Python features like dataclasses and timezone-aware datetime objects. Yes, with conditions. Install if you need async gRPC support, type hints, and idiomatic Python code generation from Protobuf 3 schemas. The low install friction, active maintenance, and MIT license support adoption. However, accept that the project is under active development with incomplete documentation and potential breaking changes—unsuitable for production systems requiring stability guarantees. ## Install pip install betterproto2-compiler uv add betterproto2-compiler poetry add betterproto2-compiler ## Installing betterproto2-compiler Before you install: Low install friction with a pure-wheel distribution. The package is actively maintained with a recent commit history, though it explicitly notes ongoing development and potential breaking changes. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: pip install betterproto2-compiler from betterproto2 import Message class Example(Message): name: str = 1 Requires Python 3.10 or higher; the package is under active development and may introduce breaking changes. Verify before relying: - Exact scope of breaking changes expected during active development and timeline for stabilization - Whether generated code is fully compatible with standard gRPC tooling and ecosystems - Performance characteristics compared to the original betterproto or Google's protoc plugin ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 119.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags protobuf code generation python, grpc compiler async python, protobuf to python dataclass, modern protobuf python, grpc code generator, protobuf3 python compiler, async grpc python, protobuf, grpc, code-generation [View on SkillFed](https://skillfed.io/packages/betterproto2-compiler) · [View on PyPI](https://pypi.org/project/betterproto2-compiler/)