Registry / serialization / betterproto2-compiler

betterproto2-compiler

JSON →
library0.10.1pypypiunverified

Compiler for betterproto2, a Python protobuf library with async support, Pydantic integration, and typed generated code. Current version 0.9.0. Releases are coupled with the betterproto2 library; compiler versions match library releases with a 'compiler-v' tag. Released monthly or on-demand.

pip install betterproto2-compiler
INSTALL
IMPORT
SIG · BETTERPROTO2-COMPI
B
betterproto2-compiler
serializationpythonv0.10.1
Install
2.7s avg
Import
Disk
19MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.10.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 3.15s
py 3.11
✓ —
✓ 2.8s
py 3.12
✓ —
✓ 2.4s
py 3.13
✓ —
✓ 2.45s
py 3.9
✕ build_error
✕ build_error
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Compile
from betterproto2_compiler import Compile
from betterproto2_compiler import Compile

Compile all .proto files in 'my_protos' directory into Python modules in 'output/'.

from betterproto2.compiler import Compile from pathlib import Path # Generate Python code from .proto files Compile.from_path(Path("my_protos")).compile(Path("output/"))
Debug
Known issues
breakingThe Compile API changed in compiler v0.7.0. Old code using Compiler or compiler.Compile may break. Use Compile.from_path() and .compile() methods.
fix
Update to betterproto2-compiler >=0.7.0 and use the new Compile class.
affects: <0.7.0
deprecatedThe old betterproto (v1) compiler is deprecated and incompatible with betterproto2. Do not mix packages.
fix
Uninstall betterproto and install betterproto2-compiler.
affects: all
gotchaThe compiler requires Python >=3.10 and <4.0. Older Python versions will fail to install.
fix
Use Python 3.10 to 3.12 (3.13 not yet tested).
affects: 0.9.0
gotchaGenerated code imports runtime library 'betterproto2'. If you only install the compiler, generated code will fail at runtime without betterproto2 installed.
fix
Install both: pip install betterproto2 betterproto2-compiler
affects: all
Upgrade
Version history
0.10.1latest on PyPI · released May 13, 2026
Audit
Dependencies
grpcliboptionalOptional dependency for gRPC service generation.
betterproto2requiredRuntime library required for generated code.
Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
1
Resources
betterproto2-compiler — pip install betterproto2-compiler · libregistry