hatch-protobuf
A Hatch build plugin to generate Python files from Protocol Buffers .proto files
Decision gist · record as of 2026-08-14
Yes, if you use Hatch and Protocol Buffers. Low friction to install, no known vulnerabilities, actively maintained, and solves a real build-automation problem. The pre-alpha status (Development Status :: 2) suggests the API may change, so pin the version in your build dependencies. Not worth installing if you don't use Hatch or don't generate code from `.proto` files.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Hatch as your build system; grpcio-tools must be available in your environment to run protoc.
- Low install friction; pure Python wheel with only two runtime dependencies (grpcio-tools and hatchling).
- Repository is active with recent commits and no known vulnerabilities.
License · maintenance · safety
MPL-2.0 (copyleft) — Licensed under MPL-2.0 (copyleft). You must disclose source code modifications and distribute under the same license if you modify the plugin itself, though generated code is not affected.
last release 2025-07-16 (394 days) · last repo commit 2026-08-11 · 14 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 190,511 downloads/mo, #9,908 on PyPI
Alternatives
Verify before relying
# Add to pyproject.toml:
[tool.hatch.build.hooks.protobuf]
dependencies = ["hatch-protobuf"]
# Then run:
pip install hatch-protobuf
hatch build- Whether custom protoc plugins (e.g., TypeScript generators) work reliably with non-Python targets.
- Performance characteristics when processing large numbers of .proto files or deeply nested proto_paths.
- Compatibility with editable installs of packages that provide .proto files for import.
What it is and what it does
hatch-protobuf is a build-time plugin for the Hatch package manager that automates the generation of Python code from Protocol Buffer definitions. It wraps grpcio-tools' protoc compiler and integrates it into Hatch's build hook system, so `.proto` files are compiled to Python during package builds without manual steps.
The plugin generates Python message classes and gRPC service stubs by default, with optional `.pyi` type stub files for static analysis. It supports custom generators (e.g., for TypeScript or other languages), can import `.proto` definitions from installed packages via site-packages, and allows configuration of input/output paths and protoc options through `pyproject.toml`. It's designed for projects that use Protocol Buffers as part of their build process and want code generation to happen automatically during packaging.
Use it for
- Generate gRPC service stubs and message classes during package build for microservices that use Protocol Buffers.
- Consume `.proto` definitions from published packages (e.g., googleapis-common-protos) without rebuilding them.
- Integrate custom protoc plugins (TypeScript, Go, etc.) into a Python project's build pipeline.
- Maintain type stubs (.pyi files) alongside generated Protocol Buffer code for IDE and mypy support.
- Automatically compile `.proto` files in src-layout or flat-layout projects with sensible defaults.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you use Hatch and Protocol Buffers.
Low friction to install, no known vulnerabilities, actively maintained, and solves a real build-automation problem. The pre-alpha status (Development Status :: 2) suggests the API may change, so pin the version in your build dependencies. Not worth installing if you don't use Hatch or don't generate code from `.proto` files.
Install
hatch-protobuf on PyPI
Before you install
Low install friction; pure Python wheel with only two runtime dependencies (grpcio-tools and hatchling). Repository is active with recent commits and no known vulnerabilities.
Requires Hatch as your build system; grpcio-tools must be available in your environment to run protoc.
License in practice
Licensed under MPL-2.0 (copyleft). You must disclose source code modifications and distribute under the same license if you modify the plugin itself, though generated code is not affected.
Quickstart
# Add to pyproject.toml:
[tool.hatch.build.hooks.protobuf]
dependencies = ["hatch-protobuf"]
# Then run:
pip install hatch-protobuf
hatch build
Verify before relying
- Whether custom protoc plugins (e.g., TypeScript generators) work reliably with non-Python targets.
- Performance characteristics when processing large numbers of .proto files or deeply nested proto_paths.
- Compatibility with editable installs of packages that provide .proto files for import.
Package facts
| License | MPL-2.0 copyleft |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesgrpcio-toolshatchling |
| Maintenance | Actively maintained 394 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 190,511 / month, #9,908 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 2 - Pre-AlphaFramework :: HatchIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonTopic :: Software Development :: Code Generators |
Evidence: hatch_protobuf-0.5.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “hatch build plugin protobuf”
- hatch-protobufA Hatch build plugin that generates Python files from Protocol…
- hatch_build_scriptsA Hatch build plugin that runs arbitrary shell commands during…
- uv-dynamic-versioningA Hatch plugin that automatically derives package versions from VCS…
Give your agent the search over MCP, or paste the wish link into any chat.
More Code Generators packages
Proto Plus wraps protocol buffers to provide Python classes that behave like native Python types while maintaining protocol buffer serialization and schema validation.
Install it if you're working with protocol buffers in Python and want a more Pythonic interface, or if you're using Google Cloud libraries that depend on it.
Cython is a source code translator that compiles Python code to C, enabling optional static typing and direct C/C++ interoperability to generate efficient native extensions.
Install it if you need to optimize Python performance, wrap C/C++ libraries, or build fast native extensions.
Annotates Python abstract syntax trees with the positions of tokens and source code text, enabling tools to map AST nodes back to their originating code for refactoring, analysis, and transformation.
Beartype is a runtime type checker that validates Python type hints at function call time, catching type violations before they cause downstream bugs.
Install it if you want runtime type safety for your annotated code or need to validate type hints on third-party packages.
llvmlite provides a lightweight Python binding to LLVM's IR builder, optimizer, and JIT compiler APIs, enabling you to write JIT compilers and code generators without needing the full LLVM C++ API surface.
astor converts Python abstract syntax trees (ASTs) back to readable source code and provides tools for AST manipulation, inspection, and non-recursive tree traversal.
Install it if you need AST round-tripping or advanced tree inspection.
See also grpcio-tools · opensearch-protobufs · protoletariat · setuptools-protobuf · nanopb · grpc-gateway-protoc-gen-openapiv2 · xds-protos · protoc-gen-openapiv2 · aristaproto · pylint-protobuf