protoc-gen-validate
PGV for python via just-in-time code generation
What it is and what it does
Protoc-gen-validate is a Python implementation that enforces semantic validation rules on protocol buffer messages at runtime. While protobuf's type system guarantees structural correctness, it cannot enforce business logic constraints like value ranges, string patterns, or required relationships between fields. This package reads validation annotations embedded in your protobuf schema and applies runtime checks that raise ValidationFailed when a message violates those constraints.
The package depends on Jinja2, protobuf, and validate-email to generate and execute validators. It supports Python 3.10 through 3.13 and installs with low friction as a pure Python wheel. The repository is archived and abandoned, meaning no new features or security patches are being released, so it is suitable only for stable, self-contained use cases where you can accept the risk of unpatched issues.
Use it for:
- Validate incoming API request payloads against business rules before processing.
- Enforce data integrity constraints in microservices that exchange protobuf messages across service boundaries.
- Catch invalid data early in a data pipeline by validating protocol buffer records before storage.
- Test that generated protobuf messages conform to schema-defined rules in unit tests.
- Ensure user input meets semantic requirements when deserializing protobuf from untrusted sources.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Validates protocol buffer messages against semantic rules defined in protobuf schema annotations, enforcing constraints that go beyond type checking.
Yes, with conditions. The package solves a real problem—runtime semantic validation of protobuf messages—and has low install friction and no known vulnerabilities. However, the repository is archived and abandoned, so install only if you are comfortable maintaining a frozen dependency or if your validation rules are stable and unlikely to need updates. Verify the license terms before use in commercial contexts.
Install
protoc-gen-validate on PyPI
pip
pip install protoc-gen-validateuv
uv add protoc-gen-validatepoetry
poetry add protoc-gen-validateInstalling protoc-gen-validate
Before you install
Low install friction with pure Python wheels. Repository is archived and marked abandoned as of the last commit in 2026-05-27, with no active maintenance—use only if you accept the risk of unpatched issues.
License in practice
License status is unclear; no SPDX identifier or raw license text is available. Verify the actual license terms before depending on this package in commercial or restricted contexts.
Quickstart
pip install protoc-gen-validate
from protoc_gen_validate.validator import validate, ValidationFailed
try:
validate(message)
except ValidationFailed as err:
print(err)
Requires Python 3.10 or later; protobuf messages must be generated with validation annotations in the schema.
Verify before relying
- Which protobuf validation rules from validate.proto are actually implemented in this Python version
- Whether the abandoned status affects compatibility with current protobuf library versions
- Actual license terms and attribution requirements for the package
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — Jinja2, protobuf, validate-email |
| Maintenance | abandoned — 177 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 208,130/month — #9,535 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: protoc_gen_validate-1.3.3-py3-none-any.whl
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
protovalidateValidates Protocol Buffer messages against…
permissive · top 5,000 on PyPI
pure-protobufEncodes and decodes Protocol Buffer messages…
permissive · top 15,000 on PyPI
proto-plusProto Plus wraps protocol buffers to provide…
permissive · top 1,000 on PyPI
dbt-protosProvides Python Protocol Buffer bindings for…
permissive · top 1,000 on PyPI
foxglove-schemas-protobufProvides precompiled Protobuf message classes…
permissive · top 15,000 on PyPI
protoc-wheel-0Provides pre-built wheels of the Google…
permissive · top 15,000 on PyPI
opensearch-protobufsProvides pre-generated Python Protocol Buffer…
permissive · top 5,000 on PyPI
pylint-protobufA Pylint plugin that makes Pylint understand…
permissive · top 15,000 on PyPI
nanopbNanopb is a code generator and runtime library…
permissive · top 15,000 on PyPI
rfc3987-syntaxValidates that strings conform to the ABNF…
permissive · top 1,000 on PyPI