Skip to content

Upgrade cel-python to 0.4.0 and update usage #2015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements/requirements-examples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protobuf
azure-identity
azure-keyvault-keys
boto3
cel-python>=0.1.5
cel-python>=0.4.0
google-auth
google-api-core
google-cloud-kms
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements-rules.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
azure-identity
azure-keyvault-keys
boto3>=1.35
cel-python>=0.1.5
cel-python>=0.4.0
google-auth
google-api-core
google-cloud-kms
Expand All @@ -10,4 +10,4 @@ hvac
jsonata-python
# Dependency of cel-python. Use version 6 due to https://github.com/yaml/pyyaml/issues/601
pyyaml>=6.0.0
tink
tink
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ def in_has() -> bool:
class InterpretedRunner(celpy.InterpretedRunner):
def evaluate(self, context):
class Evaluator(celpy.Evaluator):
def macro_has_eval(self, exprlist):
def macro_has_eval(self, exprlist) -> celpy.celtypes.BoolType:
_has_state.in_has = True
result = super().macro_has_eval(exprlist)
_has_state.in_has = False
return result

e = Evaluator(ast=self.ast, activation=self.new_activation(context), functions=self.functions)
value = e.evaluate()
e = Evaluator(ast=self.ast, activation=self.new_activation())
value = e.evaluate(context)
return value