protobuf_to_pydantic
Generate the `pydantic.BaseModel` class (and the corresponding source code) with parameter verification function through the Protobuf file
Decision gist · record as of 2026-08-14
Yes. The package solves a real friction point—keeping Protobuf schemas and Pydantic models in sync—with low install overhead, active maintenance, permissive licensing, and no known vulnerabilities. It supports Python 3.7 through 3.12 and integrates cleanly into existing protoc workflows. Install it if your project uses both protobuf and pydantic and you want to avoid hand-maintaining duplicate message definitions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Plugin mode requires mypy-protobuf as an additional dependency; protoc or grpc_tools must be available in your environment.
- Low friction install with just pydantic and protobuf as runtime dependencies.
- Repository is active with a recent commit on 2026-06-07 and 148 stars; last release was 433 days ago, suggesting stable maintenance rather than rapid iteration.
License · maintenance · safety
Apache Software License (permissive) — Licensed under Apache Software License, a permissive license that allows commercial and private use with minimal restrictions, making it safe to adopt in most projects.
last release 2025-06-07 (433 days) · last repo commit 2026-06-07 · 148 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 520,804 downloads/mo, #6,208 on PyPI
Alternatives
Verify before relying
pip install protobuf_to_pydantic
# Plugin mode (recommended):
python -m grpc_tools.protoc -I. --protobuf-to-pydantic_out=. example.proto
# Runtime mode:
from protobuf_to_pydantic import message_to_pydantic- Exact scope of proto-gen-validate compatibility and which validation rules are currently supported versus planned.
- Whether template customization is documented with concrete examples beyond the configuration file structure shown.
- Performance characteristics when converting large or deeply nested Protobuf schemas.
- Specific API surface and function names available in runtime mode for instantiating Pydantic models from protobuf messages.
What it is and what it does
protobuf_to_pydantic bridges Protobuf message definitions and Pydantic models, letting you generate validated Python dataclasses from .proto files. It works in two modes: as a protoc plugin that generates source code files (the recommended approach), or at runtime by parsing Protobuf Message objects directly into Pydantic classes. The generated models inherit Pydantic's validation rules and are compatible with both Pydantic V1 and V2.
The package supports multiple validation rule sets including proto-gen-validate, and allows customization through template configuration. It depends on pydantic and protobuf at runtime, making integration straightforward for projects already using either library. The plugin mode generates files with a _p2p.py suffix, keeping generated code separate from hand-written code.
Use it for
- Generate type-safe Pydantic models from existing .proto schemas to avoid manual dataclass duplication and keep definitions synchronized.
- Add Pydantic validation to Protobuf messages in gRPC services without rewriting message definitions.
- Convert Protobuf validation rules into Pydantic field constraints during code generation.
- Dynamically instantiate Pydantic models from Protobuf Message objects at runtime for serialization or API responses.
- Maintain a single source of truth for message schemas across Protobuf and Python codebases with automatic synchronization.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package solves a real friction point—keeping Protobuf schemas and Pydantic models in sync—with low install overhead, active maintenance, permissive licensing, and no known vulnerabilities. It supports Python 3.7 through 3.12 and integrates cleanly into existing protoc workflows. Install it if your project uses both protobuf and pydantic and you want to avoid hand-maintaining duplicate message definitions.
Install
protobuf-to-pydantic on PyPI
Before you install
Low friction install with just pydantic and protobuf as runtime dependencies. Repository is active with a recent commit on 2026-06-07 and 148 stars; last release was 433 days ago, suggesting stable maintenance rather than rapid iteration.
Plugin mode requires mypy-protobuf as an additional dependency; protoc or grpc_tools must be available in your environment.
License in practice
Licensed under Apache Software License, a permissive license that allows commercial and private use with minimal restrictions, making it safe to adopt in most projects.
Quickstart
pip install protobuf_to_pydantic
# Plugin mode (recommended):
python -m grpc_tools.protoc -I. --protobuf-to-pydantic_out=. example.proto
# Runtime mode:
from protobuf_to_pydantic import message_to_pydantic
Verify before relying
- Exact scope of proto-gen-validate compatibility and which validation rules are currently supported versus planned.
- Whether template customization is documented with concrete examples beyond the configuration file structure shown.
- Performance characteristics when converting large or deeply nested Protobuf schemas.
- Specific API surface and function names available in runtime mode for instantiating Pydantic models from protobuf messages.
Package facts
| License | Apache Software License permissive |
| Python support | Supports the current Python release <4.0,>=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespydanticprotobuf |
| Maintenance | Actively maintained 433 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 520,804 / month, #6,208 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: Other/Proprietary LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: protobuf_to_pydantic-0.3.3.1-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 › “protobuf to pydantic conversion”
- protobuf_to_pydanticConverts Protobuf message definitions into Pydantic models with…
- protobuf3-to-dictConverts protocol buffer messages to Python dictionaries and back,…
- betterproto-rust-codecProvides fast Rust-based conversion between betterproto messages and…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also mypy-protobuf · aristaproto · hatch-protobuf · betterproto · setuptools-protobuf · pbspark · proto-schema-parser · betterproto-fw · sigstore-models · sigstore-protobuf-specs