skillfed

protovalidate

Protocol Buffer Validation for Python

protovalidate v1.2.0 1.8M downloads/30d#3,515 on PyPI66
Permissive license Apache-2.0 Active released

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 protovalidate

uv

uv add protovalidate

poetry

poetry add protovalidate

Installing 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

Operating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Typing :: Typed

Tags

protobuf message validationprotocol buffer validationprotobuf field constraintsCEL validation rulesprotobuf semantic validationbuf validate pythonprotobuf message constraints
protobufvalidationgrpc

More Quality Assurance packages