{"id":21001,"library":"betterproto2-compiler","title":"BetterProto2 Compiler","description":"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.","status":"active","version":"0.9.0","language":"python","source_language":"en","source_url":"https://github.com/betterproto/python-betterproto2","tags":["protobuf","compiler","code-generation","grpc","pydantic"],"install":[{"cmd":"pip install betterproto2-compiler","lang":"bash","label":"Standard install"},{"cmd":"pip install betterproto2-compiler[grpclib]","lang":"bash","label":"Install with gRPC support"}],"dependencies":[{"reason":"Optional dependency for gRPC service generation.","package":"grpclib","optional":true},{"reason":"Runtime library required for generated code.","package":"betterproto2","optional":false}],"imports":[{"wrong":"from betterproto2_compiler import Compile","symbol":"Compile","correct":"from betterproto2_compiler import Compile"}],"quickstart":{"code":"from betterproto2.compiler import Compile\nfrom pathlib import Path\n\n# Generate Python code from .proto files\nCompile.from_path(Path(\"my_protos\")).compile(Path(\"output/\"))","lang":"python","description":"Compile all .proto files in 'my_protos' directory into Python modules in 'output/'."},"warnings":[{"fix":"Update to betterproto2-compiler >=0.7.0 and use the new Compile class.","message":"The Compile API changed in compiler v0.7.0. Old code using Compiler or compiler.Compile may break. Use Compile.from_path() and .compile() methods.","severity":"breaking","affected_versions":"<0.7.0"},{"fix":"Uninstall betterproto and install betterproto2-compiler.","message":"The old betterproto (v1) compiler is deprecated and incompatible with betterproto2. Do not mix packages.","severity":"deprecated","affected_versions":"all"},{"fix":"Use Python 3.10 to 3.12 (3.13 not yet tested).","message":"The compiler requires Python >=3.10 and <4.0. Older Python versions will fail to install.","severity":"gotcha","affected_versions":"0.9.0"},{"fix":"Install both: pip install betterproto2 betterproto2-compiler","message":"Generated code imports runtime library 'betterproto2'. If you only install the compiler, generated code will fail at runtime without betterproto2 installed.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.9.0':21 'async':11 'betterproto2':1,5,27 'code':18,49 'code-gener':48 'compil':2,3,29,37,47 'compiler-v':36 'coupl':24 'current':19 'demand':45 'generat':17,50 'grpc':51 'integr':14 'librari':9,28,32 'match':31 'month':41 'on-demand':43 'protobuf':8,46 'pydant':13,52 'python':7 'releas':22,33,40 'support':12 'tag':39 'type':16 'v':38 'version':20,30","created_at":"2026-04-27T16:57:33.248558+00:00","updated_at":"2026-04-27T16:57:33.248558+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nImportError: cannot import name 'Compile' from 'betterproto2_compiler' (/tmp/tmpd99k19h_/venv/lib/python3.12/site-packages/betterproto2_compiler/__init__.py)"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.10.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/betterproto/python-betterproto2","docs":"https://betterproto.github.io/python-betterproto2/","changelog":null,"pypi":"https://pypi.org/project/betterproto2-compiler/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}