--- id: common-expression-language version: "0.7.0" license: unclear license_treatment: permissive maintenance: active --- # common-expression-language — Python bindings for the Common Expression Language (CEL) License: permissive · Maintenance: active · Downloads: 137.3K/mo ## 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 above — 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 pip install common-expression-language uv add common-expression-language poetry add common-expression-language ## Installing 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_current - Install friction: medium - Maintenance: active - Downloads: 137.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags CEL expression evaluation, policy rule engine, safe expression language, dynamic rule evaluation, access control rules, feature flag conditions, configuration validation, expression-evaluation, policy-engine, rust-backed [View on SkillFed](https://skillfed.io/packages/common-expression-language) · [View on PyPI](https://pypi.org/project/common-expression-language/)