protovalidate-py
Protovalidate is the semantic validation library for Protobuf. It provides standard annotations to validate common rules on messages and fields, as well as the ability to use CEL to write custom rules. It's the next generation of protoc-gen-validate.
With Protovalidate, you can annotate your Protobuf messages with both standard and custom validation rules:
syntax = "proto3";
package acme.user.v1;
import "buf/validate/validate.proto";
message User {
string id = 1 [(buf.validate.field).string.uuid = true];
uint32 age = 2 [(buf.validate.field).uint32.lte = 150]; // We can only hope.
string email = 3 [(buf.validate.field).string.email = true];
string first_name = 4 [(buf.validate.field).string.max_len = 64];
string last_name = 5 [(buf.validate.field).string.max_len = 64];
option (buf.validate.message).cel = {
id: "first_name_requires_last_name"
message: "last_name must be present if first_name is present"
expression: "!has(this.first_name) || has(this.last_name)"
};
}
Once you've added protovalidate to your project, validation is idiomatic Python:
try:
protovalidate.validate(message)
except protovalidate.ValidationError as e:
# Handle failure.
Installation
[!TIP] The easiest way to get started with Protovalidate for RPC APIs are the quickstarts in Buf's documentation. There's one available for Python and gRPC.
To install the package, use pip:
pip install protovalidate
protovalidate is implemented as a Python native extension. We publish wheels for common platforms and you will usually download a pre-built wheel. For others, ensure you have Rust and a C++ compiler available, and it will be automatically built during installation.
Documentation
Comprehensive documentation for Protovalidate is available at protovalidate.com.
Highlights for Python developers include:
- The developer quickstart
- A comprehensive RPC quickstart for Python and gRPC
- A migration guide for protoc-gen-validate users
Additional languages and repositories
Protovalidate isn't just for Python! You might be interested in sibling repositories for other languages:
protovalidate-go(Go)protovalidate-java(Java)protovalidate-cc(C++)protovalidate-es(TypeScript and JavaScript)
Additionally, protovalidate's core repository provides:
- Protovalidate's Protobuf API
- Conformance testing utilities for acceptance testing of
protovalidateimplementations
Benchmarks
We include a set of benchmarks to verify different types of validation operations based on pytest-benchmark.
You can run them with
$ uv run poe bench
This persists the runs results. It is often helpful to compare benchmark results between runs, for example before and after an optimization. To compare persisted results, use
$ uv run poe bench-compare
Contributing
We genuinely appreciate any help! If you'd like to contribute, check out these resources:
- Contributing Guidelines: Guidelines to make your contribution process straightforward and meaningful
- Conformance testing utilities: Utilities providing acceptance testing of
protovalidateimplementations
Legal
Offered under the Apache 2 license.
Metadata
Release files for protovalidate 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| protovalidate-2.0.0.tar.gz | 18.9 MB | Details |
Built distributions (wheels)
Total release size: 93.3 MB
Release files / protovalidate-2.0.0.tar.gz
| Download URL | protovalidate-2.0.0.tar.gz |
|---|---|
| Size | 18.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2fce76be2afc91f1c2f57b0d1bba26a1681cf687ba387a3a4bea6a69e13a805
|
|
BLAKE2b-256 checksum How to use checksums |
c673f9ec1cbeb4caf28e695e966ba5b13397c598f523170d305ec05d03309b03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-win_arm64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-win_arm64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows ARM64 |
|
SHA-256 checksum How to use checksums |
1e797abc70fb89513d2556a85c89d066c8204f2f5b84944f0a485d5e0c87567b
|
|
BLAKE2b-256 checksum How to use checksums |
fed12bfed5e8228d1c90e651a879fad7136e06e82dee2ea0d9063b82f87c2104
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-win_amd64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5ef05e596a5a7b333b33d45c02c81a95db6d6c291c520716c36031a691925647
|
|
BLAKE2b-256 checksum How to use checksums |
f333a922f91110f8ef7eb58da6bf2c883c6592a31af641a17039f51e626ce02b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 10.1 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
ffc55c8988f00bfd2a01cc951fb31a217ccd07e27b5b0d23d811be8754e562d7
|
|
BLAKE2b-256 checksum How to use checksums |
42b202960bc493fc67b9d215c47437645a2581e220cafc817be535fff5f939c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 9.6 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
c3e105e5304fe74295a4f52d0aace8382f7b1934dcbbb396fa21f475e7d1a5d3
|
|
BLAKE2b-256 checksum How to use checksums |
402b233c0a97ff1941592e271bb38b95df5fc538a5e3bae48745f45ec040e404
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8ce2601b2734cc0a5e8fce1d8c39dfcabec8033a271ddb140e9eb3488765dae2
|
|
BLAKE2b-256 checksum How to use checksums |
be2d3ffc43b6bdec33232041311b9aa58a7e67b097ca03b807ac099f46b9e750
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ ARM64 |
|
SHA-256 checksum How to use checksums |
fb63d5c09687248ba583b917b368ce6e214890a1e86831dc80ed54e72967718b
|
|
BLAKE2b-256 checksum How to use checksums |
c31e8260ab04a9bcb50393dc9b34cf977f7b85d50daf7a6b78118f37ad428547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9d632d66535c29d86eaa6d7148b66d8e9ce76cf6475f1c820b39bc197e67d356
|
|
BLAKE2b-256 checksum How to use checksums |
dc241d69b31c89868f4047a0b9bc367077d55a89b9fe42831309d3f24291fb89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp314-cp314t-macosx_10_12_x86_64.whl
| Download URL | protovalidate-2.0.0-cp314-cp314t-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
c543314a58605419c6ebcfed9559bfbf73ec34e0f8c1e42f25a93a5d32fac29d
|
|
BLAKE2b-256 checksum How to use checksums |
df13604ace01a46ee76615b6c00bffb2e52bd9f4239d8df1f35a80114fd72b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-win_arm64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
7dbd2115b0be40139badff0da80fdc4b9d2b08944ccf072bbdefaceeaabac1de
|
|
BLAKE2b-256 checksum How to use checksums |
53661b88effa91f586a4ca13614ca753d1d0ac89728970f6939e85f8adc47aa7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-win_amd64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4d4c48b64918f9da1b11cebc66cbe248a942dc42ccbfb27c32834faf9ef68348
|
|
BLAKE2b-256 checksum How to use checksums |
76b035bde6aa90d2205ae3913e023751067acaf724a3a1e9325cc4d5abcd44ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 10.1 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c88442347f2b01fc7a5d67280a99730135310400b039fe63a5ec1581c26ea8b8
|
|
BLAKE2b-256 checksum How to use checksums |
d7d67650ad5e8f23a6e0b8e4e36ea8e33c2d3ebf5a8746d49b7c3cee1d156e2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 9.6 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
be86a8253fd64a250d8e15598fcebdf3b1fd6384f6ef1f1d412b4b5cb7d47686
|
|
BLAKE2b-256 checksum How to use checksums |
8bdd677c2adb9a6ca5e7122a4558c469738c93eb88d720fd291b03a6a6bdb375
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fe8c9e237b9f034269f134d4ee0a872689b38e1c8113668a351f9f12bcfcf62e
|
|
BLAKE2b-256 checksum How to use checksums |
66b5fe5c545bb2daee3d098360604e5c34e6419c9b1e6341890a86e89da4c055
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 3.3 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
6109644d4d7be9e49e77198deac274881a281e168a0d2edefa38063e4247280e
|
|
BLAKE2b-256 checksum How to use checksums |
64235967208bb04833d566fe932f87e00bece53a30bfc5a54009a56dbf64932e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
156efdcc8a7db502f92180f5dff6dea200f8297aa2280abff2b6ca695a62a694
|
|
BLAKE2b-256 checksum How to use checksums |
1dee88f2f3a1bb548809e7c4cb000e0beee86bf3702f47b85009c23c4ecbfd75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency logRelease files / protovalidate-2.0.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | protovalidate-2.0.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
fd00fbe5297165f55aa208159e28eac27db5821bb255a65d53f659dcb4eba0cd
|
|
BLAKE2b-256 checksum How to use checksums |
d6eb3e599ef96878cf389927ad2d041c7c6d7cd76ea8d91a77819523c78d2afc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 19, 2026.
Transparency log