protovalidate
Protocol Buffer Validation for Python
What it is and what it does
Protovalidate is a semantic validation library for Protocol Buffers that enforces constraints on messages and fields at runtime. It replaces the earlier protoc-gen-validate tool and works by checking annotations you add to your .proto definitions—both built-in rules like string format validation (email, UUID) and numeric bounds, plus custom logic written in CEL (Common Expression Language). Once your Protobuf messages are annotated, you call protovalidate.validate() on message instances to check them against those rules, catching invalid data before it propagates through your application.
The package depends on cel-python for CEL expression evaluation, google-re2 for regex matching, and protobuf itself. It supports Python 3.10 and later and is actively maintained by Buf. The library integrates naturally into gRPC services and other systems that already use Protocol Buffers, making it a natural fit for teams validating structured data at API boundaries.
Use it for:
- Validate incoming gRPC request messages against field constraints and cross-field rules before processing.
- Enforce data quality rules on Protobuf messages in microservices without duplicating validation logic across languages.
- Check UUID, email, and other standard formats on string fields during message deserialization.
- Express complex validation logic (e.g., conditional field requirements) using CEL expressions in .proto files.
- Migrate from protoc-gen-validate to a unified validation approach across multiple language implementations.
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 annotations, supporting both standard field constraints and custom CEL expressions.
Yes. Protovalidate is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem for teams using Protocol Buffers. It's the recommended successor to protoc-gen-validate and integrates cleanly into gRPC and microservice workflows. Install it if you're already using Protobuf and need to validate messages at runtime.
Install
protovalidate on PyPI
pip
pip install protovalidateuv
uv add protovalidatepoetry
poetry add protovalidateInstalling protovalidate
Before you install
Low friction install with three runtime dependencies (cel-python, google-re2, protobuf). Package is actively maintained with recent releases and no known vulnerabilities.
License in practice
Licensed under Apache-2.0 (permissive), allowing use in commercial and proprietary projects with minimal restrictions.
Quickstart
pip install protovalidate
import protovalidate
try:
protovalidate.validate(message)
except protovalidate.ValidationError as e:
# Handle validation failure
Requires Python 3.10 or later; protobuf messages must be annotated with validation rules via buf.validate.field or buf.validate.message options.
Verify before relying
- Performance characteristics when validating large message volumes or deeply nested structures.
- Compatibility with custom Protobuf plugins or non-standard message generation workflows.
- Whether CEL expression evaluation supports all standard CEL functions or a subset.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — cel-python, google-re2, protobuf |
| Maintenance | actively maintained — 114 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,825,414/month — #3,515 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: protovalidate-1.2.0-py3-none-any.whl
Keywords: protobuf, protocol buffer, validate
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
protoc-gen-validateValidates protocol buffer messages against…
unclear · top 15,000 on PyPI
isolate-protoProvides gRPC protocol buffer definitions for…
unclear · top 15,000 on PyPI
protobuf-pyGenerates well-typed, readable Python code from…
permissive · top 15,000 on PyPI
sentry-protosProvides protocol buffer and gRPC schema…
unclear · top 15,000 on PyPI
protobuf-py-extNative Rust-based encoder/decoder extension…
unclear · top 15,000 on PyPI
common-expression-languageEvaluates Google's Common Expression Language…
permissive · top 15,000 on PyPI
opensearch-protobufsProvides pre-generated Python Protocol Buffer…
permissive · top 5,000 on PyPI
cel-expr-pythonA Python wrapper for the CEL C++ implementation…
permissive · top 15,000 on PyPI
protobuf3-to-dictConverts protocol buffer messages to Python…
permissive · top 5,000 on PyPI
spec-kitty-eventsProvides canonical event envelope contracts and…
permissive · top 15,000 on PyPI