Conversation
stefanvanburen
approved these changes
Jul 31, 2025
Member
stefanvanburen
left a comment
There was a problem hiding this comment.
lgtm, one nit on testextra but otherwise exactly what I was envisioning
Makefile
Outdated
|
|
||
| .PHONY: testextra | ||
| testextra: | ||
| uv pip install .[re2] |
Member
There was a problem hiding this comment.
I think we want to avoid uv pip, and instead do something like uv sync --extra re2?: https://docs.astral.sh/uv/concepts/projects/sync/#syncing-optional-dependencies
| from protovalidate.internal.extra_func import cel_matches_re, cel_matches_re2 | ||
|
|
||
| _USE_RE2 = True | ||
| spec = importlib.util.find_spec("re2") |
Member
There was a problem hiding this comment.
protovalidate/internal/extra_func.py
Outdated
|
|
||
| _USE_RE2 = True | ||
| try: | ||
| import re2 # type: ignore |
Member
There was a problem hiding this comment.
one other minor thing, if we want: could install the google-re2-stubs package as a dev dependency, which would give us type info for re2 (and we could nix the ignore here).
Member
There was a problem hiding this comment.
(published by the same person who had asked for re2 compatibility, here: #145)
stefanvanburen
approved these changes
Jul 31, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds
re2as an optional dependency to protovalidate-python. With this configured, users can choose to optionally install re2 if they explicit re2 functionality.For example
pip install protovalidate[re2]Note that while CEL requires re2 as part of the spec, our current version of cel-python (v0.2.0) doesn't. We are unable to upgrade cel-python beyond v0.2.0 at this point due to some outstanding issues, so since re2 now supports Python 3.13, we're adding it as an optional dep directly to protovalidate-python rather than the re2 workaround we had previously implemented.