--- id: protovalidate version: "1.2.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # protovalidate — Protocol Buffer Validation for Python License: permissive · Maintenance: active · Downloads: 1.8M/mo ## 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 above — 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 pip install protovalidate uv add protovalidate 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_current - Install friction: low - Maintenance: active - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags protobuf message validation, protocol buffer validation, protobuf field constraints, CEL validation rules, protobuf semantic validation, buf validate python, protobuf message constraints, protobuf, validation, grpc [View on SkillFed](https://skillfed.io/packages/protovalidate) · [View on PyPI](https://pypi.org/project/protovalidate/)