Releases: bufbuild/protovalidate-py
Release list
v2.0.0
This release targets protovalidate 1.2.0.
This is a huge release, marked by our first major version bump to v2 and a repository rename to protovalidate-py to match our new friends protobuf-py and connect-py. There are breaking changes in this release. Read on for more details.
Native performance
protovalidate-py is now a native Python extension, wrapping the implementation from protovalidate-cc while still providing a Python-native experience. Performance has been commonly brought up as an issue using protovalidate, and we hope finally we can give you performance you can be comfortable with. Many operations will be hundreds of times faster, with one of our benchmarks even showing a 800x improvement. Yes... we're sorry it took so long to address this but going forward performance is a high priority for this project. This is not the end and we have more ideas to improve even further, stay tuned.
Going native should not mean users need to build the library - we publish wheels for Linux (glibc and musl), macOS, and Windows, on amd64 and arm64. By using the Python stable ABI, they are always compatible with any version of Python 3, including the next one. In fact, this is wider compatibility then previously where our hard dependency on re2, itself a native library, would cause some lag after a new Python version. We believe this means almost all users will download the prebuilt wheel and use it just like the pure Python version, and for users that use a different platform, you only need Rust and C++ compilers installed for uv or pip to automatically build the extension (as a large amount of C++ code, it will take some time though).
Targets protobuf-py, supports google.protobuf
With this release, we have migrated our base protobuf implementation from google.protobuf to protobuf-py. This primarily means our public API returns Validation protos as protobuf-py messages instead of google.protobuf. Validating google.protobuf messages is still 100% supported, and we have no plan to ever lose that. You can still pass them to the same validation APIs with no change. We don't have a dependency declaration anymore on the protobuf package - if you happened to be pulling it in transitively via protovalidate, you will need to add protobuf directly to your project.
Validation.proto has changed to return a protobuf-py message, read-only access is similar to before, but inner messages can be None instead of automatically instantiated to an empty message. Also, if you marshal the violation protobuf, perhaps to log as JSON in a log message, you will need to update to the protobuf-py idiom for it.
Before:
for violation in validator.collect_violations(message):
print(violation.proto.rule_id)
for element in validation.proto.field.elements:
print(element)
print(MessageToJson(violation.proto))After:
for violation in validator.collect_violations(message):
print(violation.proto.rule_id)
if field := validation.proto.field:
for element in field.elements:
print(element)
print(violation.proto.to_json())Vendored in buf.validate
protovalidate now vendors gencode for buf.validate protos, meaning the library itself does not require a user to "bring their protos". This is made possible because protobuf-py does not have a global singleton that causes conflicts when multiple libraries vendor the same proto.
This does not yet solve the issue that users must bring in buf.validate as a dependency for their own protos - we are still working on support for this in protobuf-py. Until that is solved, we continue to recommend using include_imports when you generate your protos. When using protobuf-py, this has no risk of process crash so should be safe in almost all cases. We understand that when using multiple packages that do this, it can result in bloated generated code - solving the underlying issue for imports so you can depend on a package for buf.validate continues to be important to us to fix.
New Contributors
- @jonbodner-buf made their first contribution in #462
- @anuraaga made their first contribution in #473
- @LordAizen1 made their first contribution in #503
Full Changelog: v1.2.0...v2.0.0
v1.2.0
This release is compatible with the v1.2.0 release of Protovalidate.
What's Changed
- Raise a CompilationError for unknown rules by @timostamm in #445
- Update protovalidate to
v1.2.0by @srikrsna-buf in #457
Full Changelog: v1.1.2...v1.2.0
v1.1.2
This release fixes support for protobuf==7, the latest major release of the protobuf runtime library.
What's Changed
- Improve CI workflow by @stefanvanburen in #422
- Bump ruff from 0.14.14 to 0.15.0 by @dependabot[bot] in #423
- Convert pytest warnings into errors by @stefanvanburen in #424
- Bump ruff from 0.15.0 to 0.15.1 by @dependabot[bot] in #425
- Switch uv resolution back to default by @stefanvanburen in #427
- Bump ruff from 0.15.1 to 0.15.2 by @dependabot[bot] in #428
- Add handling for protobuf==7 by @stefanvanburen in #429
Full Changelog: v1.1.1...v1.1.2
v1.1.1
The biggest change in this release is bumping cel-python to 0.5.0 (see #414), which should improve performance.
What's Changed
- Bump actions/upload-artifact from 5 to 6 by @dependabot[bot] in #403
- Bump actions/download-artifact from 6 to 7 by @dependabot[bot] in #404
- Bump mypy from 1.19.0 to 1.19.1 by @dependabot[bot] in #408
- Bump ruff from 0.14.8 to 0.14.9 by @dependabot[bot] in #407
- Add ability to depend on an arbitrary upstream commit by @srikrsna-buf in #409
- Bump ruff from 0.14.9 to 0.14.10 by @dependabot[bot] in #413
- Ignore protobuf and types-protobuf in Dependabot by @stefanvanburen in #415
- Bump buf version to 1.62.1 and regenerate protos by @stefanvanburen in #416
- Bump ruff from 0.14.10 to 0.14.11 by @dependabot[bot] in #417
- Bump ruff from 0.14.11 to 0.14.13 by @dependabot[bot] in #419
- Bump pytest version to 9 by @stefanvanburen in #420
- Bump ruff from 0.14.13 to 0.14.14 by @dependabot[bot] in #421
- Upgrade cel-python to 0.5.0 by @stefanvanburen in #414
Full Changelog: v1.1.0...v1.1.1
v1.1.0
This release is compatible with the v1.1.0 release of Protovalidate.
What's Changed
- Drop Python 3.9 support by @stefanvanburen in #384
- Add support for Python 3.14 by @stefanvanburen in #379
- Make it so that you can define expression-only rules by @srikrsna-buf in #396
- Update protovalidate by @srikrsna-buf in #397
New Contributors
- @AdrienVannson made their first contribution in #393
Full Changelog: v1.0.0...v1.1.0
v1.0.0
Protovalidate is now v1.0
After two years of development, Protovalidate has reached v1.0, marking our commitment to stability and production readiness.
Read more in our blog post. Get started at https://protovalidate.com.
What's Changed
There are no functional changes compared to the previous release.
- Convert tests to pytest by @stefanvanburen in #366
- Bump actions/setup-go from 5 to 6 by @dependabot[bot] in #369
- Minor tweaks / cleanup by @stefanvanburen in #370
- Bump protovalidate version to v1.0.0 by @stefanvanburen in #372
- Use lowest-direct dependency resolution by default by @stefanvanburen in #373
Full Changelog: v0.15.0...v1.0.0
v0.15.0
Another day, another release — this time, moving to v0.15.0 as we've bundled a couple of breaking changes into one release (we hope these are the last for awhile)!
Breaking Changes
- Removed the
protovalidate.Configclass (#364)- Moved back to providing the
fail_fastkwarg to eithervalidateorcollect_validations
- Moved back to providing the
- Removed
collect_validations(..., into=)argument (#365)- Let us know if you were using / have a usecase for this!
- Made
google-re2a required dependency (#363)- This keeps our regex implementation compliant with CEL, and removes the need for the
re2extra that was added in v0.14.0.google-re2supplies wheels for all supported versions of Python, so this shouldn't be an issue, but please let us know if you have issues!
- This keeps our regex implementation compliant with CEL, and removes the need for the
What's Changed
- Improve typing by @stefanvanburen in #359
- Fix timestamp typing by @stefanvanburen in #360
- Make
google-re2required dependency by @stefanvanburen in #363 - Remove Config class in favor of fail_fast kwargs by @stefanvanburen in #364
- Remove collect_violations(..., into=) argument by @stefanvanburen in #365
Full Changelog: v0.14.1...v0.15.0
v0.14.1
This release fixes a bug with concatenated values (#354 + #357), and adds back support for protobuf==5 (#358). We plan to support protobuf==5 until protobuf==7 is released.
What's Changed
- Update links to buf.build/docs to use protovalidate.com by @jrinehart-buf in #331
- Bump actions/download-artifact from 4 to 5 by @dependabot[bot] in #349
- Add
buf formatto Makefileformattarget by @stefanvanburen in #348 - Fix Makefile dependencies by @stefanvanburen in #350
- Pin local Python version to lowest supported by @stefanvanburen in #351
- Bump actions/checkout from 4 to 5 by @dependabot[bot] in #352
- Fix instance check for concatenated values by @stefanvanburen in #354
- Add dependency resolution to test matrix by @stefanvanburen in #355
- Simplify
isinstancecall inextra_func.pyby @engnatha in #357 - Support protobuf==5 by @stefanvanburen in #358
New Contributors
Full Changelog: v0.14.0...v0.14.1
v0.14.0
Breaking Changes
Config option for custom regex removed
We have removed the regex_matches_func from the config. Now that google-re2 has pre-built binaries for Python 3.13, re2 can be fully supported inside protovalidate-python. Users no longer need to bring-their-own-re2.
To use re2 syntax, install protovalidate-python with an extra dependency on re2 as follows:
pip install protovalidate[re2]For more context, see PR #346
What's Changed
- Add re2 as optional dependency (#346) by @smaye81 in #346
- Set up trusted publishing by @stefanvanburen in #345
- Fix descriptor pool TODO by @stefanvanburen in #343
- Drop custom matcher & config by @stefanvanburen in #342
This release is compatible with protovalidate v0.14.0.
Full Changelog: v0.13.0...v0.14.0
v0.13.0
This release is compatible with the v0.14.0 release of Protovalidate.
Breaking changes
We want validation rules to be easy to understand for authors and consumers. To simplify Protovalidate, we are renaming an option and remove two others. This is a breaking change, and you will have to update your Protobuf files if they use the relevant options :
IGNORE_IF_UNPOPULATEDis renamed toIGNORE_IF_ZERO_VALUE.
See bufbuild/protovalidate#397 for details.(buf.validate.message).disabledis removed.
You can replace it by addingIGNORE_ALWAYSto every field of the message. See bufbuild/protovalidate#394 for details.IGNORE_IF_DEFAULT_VALUEis removed.
In most cases, you can replace it withIGNORE_IF_ZERO_VALUE. See bufbuild/protovalidate#396 for details.
Full Changelog: v0.12.0...v0.13.0