Fast, Safe, and Expressive evaluation of Google's Common Expression Language (CEL) in Python, powered by Rust.
The Common Expression Language (CEL) is a non-Turing complete language designed for simplicity, speed, and safety. This Python package wraps the Rust implementation cel v0.14.5, providing microsecond-level expression evaluation with seamless Python integration.
🚀 Use Cases
🛡️ Policy Enforcement: Define access control rules that can be updated without code changes
⚙️ Configuration Validation: Validate complex settings with declarative rules
🔄 Data Transformation: Transform and filter data with safe, portable expressions
📋 Business Rules: Implement decision logic that business users can understand
🔍 Query Filtering: Build dynamic filters for databases and APIs
Portability note: CEL has no portable "bytecode". Cross-implementation
interchange in the CEL ecosystem uses the protobuf AST (cel.expr.Expr /
CheckedExpr), which the upstream cel Rust crate does not yet produce or
consume. The portable artifact for this library is the CEL source string;
use Program.references() for static analysis. See the docs for details.
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=cel
# Test all documentation examples (embedded code + standalone files)
uv run --group docs pytest tests/test_docs.py -v
Building from Source
# Install development dependencies
uv sync --dev
# Build the package
uv run maturin develop
# Run tests
uv run pytest
Contributing
Contributions are welcome! Please see our documentation for: