skillfed

cel-expr-python

The CEL Python runtime

cel-expr-python v0.1.3 234.1K downloads/30d#9,029 on PyPI78
Permissive license Apache-2.0 Active released

What it is and what it does

cel-expr-python is a Python binding to the CEL C++ runtime, enabling you to parse, compile, and evaluate CEL expressions—a Google-designed language for policy evaluation and access control. It lets you define typed variables, compile expressions once for reuse, and evaluate them efficiently against different data sets. The package supports protobuf messages as first-class values, custom Python functions, optional type checking at compile time, and memory-efficient evaluation via shared arenas and activations.

You typically use it to build policy engines, authorization systems, or rule evaluators where expressions need to be safe, sandboxed, and fast. The wrapper handles the C++ complexity, exposing a straightforward Python API for environment setup, expression compilation, and evaluation with optional configuration for descriptor pools, containers, and extensions.

Use it for:

  • Authorization and access control: evaluate policies like 'user.role in ["admin"] && request.resource == "sensitive_data"'.
  • Rule engines in microservices: compile and cache expressions once, then evaluate them across many requests with different variable bindings.
  • Protobuf-based validation: check constraints on protobuf message fields within CEL expressions.
  • Custom business logic: define domain-specific functions and reuse them across multiple compiled expressions.
  • Memory-constrained evaluation: use Arena for batch evaluation to release temporary objects as a group.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A Python wrapper for the CEL C++ implementation that compiles and evaluates Common Expression Language (CEL) expressions with support for custom functions, protobuf messages, and type checking.

Yes, if you need a safe, efficient expression evaluator for policy or rule engines. The package is actively maintained, has no known vulnerabilities, supports modern Python versions with precompiled wheels, and offers a clean API for both simple and advanced use cases (custom functions, protobuf integration, memory optimization). Install friction is moderate but manageable; the Apache-2.0 license is unrestrictive.

Install

cel-expr-python on PyPI

pip

pip install cel-expr-python

uv

uv add cel-expr-python

poetry

poetry add cel-expr-python

Installing cel-expr-python

Before you install

Medium install friction due to compiled wheels for multiple Python versions (3.11–3.14) and platforms (macOS, Linux, Windows). Active maintenance with a recent release (50 days ago) and an active repository.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you must include a copy of the license and state significant changes.

Quickstart

pip install cel-expr-python

from cel_expr_python import cel

cel_env = cel.NewEnv(variables={"x": cel.Type.INT, "y": cel.Type.INT})
expr = cel_env.compile("x + y > 10")
result = expr.eval(data={"x": 7, "y": 4})
print(result.value())  # True

Requires Python 3.11 or later; precompiled wheels available for macOS (Intel and ARM), Linux (x86_64 and aarch64), and Windows.

Verify before relying

  • Performance characteristics compared to direct CEL C++ usage or alternative expression evaluators.
  • Whether custom extensions beyond math and string libraries are documented or supported.
  • Serialization format stability and forward/backward compatibility guarantees.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.11)
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 50 days since the last release
Last repo commit
First released
Downloads 234,122/month — #9,029 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cel_expr_python-0.1.3-cp311-cp311-macosx_10_13_x86_64.whl; cel_expr_python-0.1.3-cp311-cp311-macosx_11_0_arm64.whl; cel_expr_python-0.1.3-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; cel_expr_python-0.1.3-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; cel_expr_python-0.1.3-cp311-cp311-win_amd64.whl; cel_expr_python-0.1.3-cp312-cp312-macosx_10_13_x86_64.whl; cel_expr_python-0.1.3-cp312-cp312-macosx_11_0_arm64.whl; cel_expr_python-0.1.3-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; cel_expr_python-0.1.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; cel_expr_python-0.1.3-cp312-cp312-win_amd64.whl; cel_expr_python-0.1.3-cp313-cp313-macosx_10_13_x86_64.whl; cel_expr_python-0.1.3-cp313-cp313-macosx_11_0_arm64.whl; cel_expr_python-0.1.3-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; cel_expr_python-0.1.3-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; cel_expr_python-0.1.3-cp313-cp313-win_amd64.whl; cel_expr_python-0.1.3-cp314-cp314-macosx_10_15_x86_64.whl; cel_expr_python-0.1.3-cp314-cp314-macosx_11_0_arm64.whl; cel_expr_python-0.1.3-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl; cel_expr_python-0.1.3-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl; cel_expr_python-0.1.3-cp314-cp314-win_amd64.whl

Operating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIX :: LinuxTopic :: Software Development :: InterpretersTopic :: Software Development :: Libraries :: Python Modules

Tags

CEL expression evaluationcommon expression language pythonpolicy evaluation engineexpression compiler runtimeCEL protobuf supportcustom function expressionstype-checked expression language
policy-evaluationexpression-languageprotobuf-integration

More Python Modules packages