common-expression-language
Python bindings for the Common Expression Language (CEL)
What it is and what it does
Common Expression Language is a Python wrapper around the Rust CEL interpreter, designed to evaluate safe, declarative expressions without the overhead of a full programming language. It accepts CEL source strings and optional context (variables and custom functions), returning results in microseconds. The package is built for scenarios where you need to let untrusted users or external systems define logic—policies, feature flags, validation rules, data filters—without exposing a full Python interpreter.
The library supports a rich type system (integers, floats, strings, lists, maps, timestamps, durations, bytes, optionals) and can compile expressions for reuse across multiple contexts. It includes a command-line REPL and batch tool, optional standard library extensions (strings, math, sets, encoders, lists), and static analysis capabilities to inspect which variables and functions an expression references before execution.
Use it for:
- Define and update access control policies without redeploying code; evaluate rules based on user roles and resource ownership.
- Validate complex configuration settings with declarative rules; e.g., numeric bounds and logical constraints.
- Create sophisticated feature flag conditions that business users can understand and modify.
- Build dynamic database and API query filters from user input safely.
- Implement business decision logic that can be updated at runtime without code changes.
- Transform and filter data with portable, safe expressions that can be shared across systems.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Evaluates Google's Common Expression Language (CEL) expressions in Python with microsecond-level performance, powered by a Rust backend, supporting safe, non-Turing-complete rule evaluation.
Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and solves a real problem—safe, fast evaluation of user-defined logic. Medium install friction is acceptable given the compiled-wheel distribution strategy. Install it if you need to evaluate untrusted expressions, define policies externally, or let non-developers write business rules.
Install
common-expression-language on PyPI
pip
pip install common-expression-languageuv
uv add common-expression-languagepoetry
poetry add common-expression-languageInstalling common-expression-language
Before you install
Medium install friction due to compiled wheels across multiple Python versions and architectures. Active maintenance with a recent release (41 days old) and ongoing repository activity. Requires Python 3.11 or later.
License in practice
Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install common-expression-language
from common_expression_language import evaluate
result = evaluate("age >= 18", {"age": 25})
Requires Python 3.11 or later; compiled wheels are provided for common platforms.
Verify before relying
- Whether the Rust backend introduces any runtime dependencies or system library requirements beyond the wheel distributions.
- Performance characteristics under high-volume expression evaluation in production workloads.
- Compatibility guarantees and stability of the Python API across minor version updates.
- Exact import path and API surface for the evaluate function and Context class.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | 4 — typer, rich, prompt-toolkit, pygments |
| Maintenance | actively maintained — 41 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 137,284/month — #11,373 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: common_expression_language-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl; common_expression_language-0.7.0-cp311-cp311-macosx_11_0_arm64.whl; common_expression_language-0.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; common_expression_language-0.7.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; common_expression_language-0.7.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; common_expression_language-0.7.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl; common_expression_language-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; common_expression_language-0.7.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl; common_expression_language-0.7.0-cp311-cp311-win32.whl; common_expression_language-0.7.0-cp311-cp311-win_amd64.whl; common_expression_language-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl; common_expression_language-0.7.0-cp312-cp312-macosx_11_0_arm64.whl; common_expression_language-0.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; common_expression_language-0.7.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; common_expression_language-0.7.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; common_expression_language-0.7.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl; common_expression_language-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; common_expression_language-0.7.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl; common_expression_language-0.7.0-cp312-cp312-win_amd64.whl; common_expression_language-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
cel-pythonParses and evaluates Google Common Expression…
unclear · top 5,000 on PyPI
zen-enginezen-engine is a Python binding for a Rust-based…
unclear · top 15,000 on PyPI
cel-expr-pythonA Python wrapper for the CEL C++ implementation…
permissive · top 15,000 on PyPI
pure-evalSafely evaluate Python AST nodes without…
permissive · top 1,000 on PyPI
rule-engineRule Engine provides a lightweight, custom…
permissive · top 15,000 on PyPI
levalLeval evaluates limited expressions safely by…
permissive · top 15,000 on PyPI
regressProvides Python bindings to the Rust regress…
permissive · top 5,000 on PyPI
protovalidateValidates Protocol Buffer messages against…
permissive · top 5,000 on PyPI
cwl-utilsLoads, parses, and manipulates Common Workflow…
permissive · top 15,000 on PyPI
yggdrasil-engineProvides Python bindings to the Unleash…
permissive · top 5,000 on PyPI