skillfed

cel-python

Pure Python implementation of Google Common Expression Language

cel-python v0.5.0 6.7M downloads/30d#1,867 on PyPI
License unclear AGING released

What it is and what it does

cel-python is a pure Python runtime for Google's Common Expression Language, a domain-specific language designed for secure, portable expression evaluation across systems without exposing the full power of Python. It compiles CEL source code into an abstract syntax tree, then into an executable program that can be evaluated against provided context data. The package is intended for use cases where you need to safely evaluate user-supplied or policy-defined expressions—such as security filters, access control rules, or data validation—without the risks of arbitrary code execution.

The implementation follows the Go CEL reference closely, with six core dependencies (google-re2, jmespath, lark, pendulum, pyyaml, tomli) that handle regex matching, JSON path queries, parsing, date/time operations, and configuration. It can be used as a library within Python applications or invoked from the command line as a calculator-like tool or JSON filter. Type semantics differ from Python's native types; division truncates toward zero rather than toward negative infinity, and type coercion is minimal.

Use it for:

  • Embed security policy filters in infrastructure-as-code systems to evaluate compliance rules without executing arbitrary Python code.
  • Evaluate access control expressions in API gateways or authorization systems where policies must be portable across languages.
  • Validate or transform JSON data from stdin using CEL expressions, similar to jq but with CEL's type system and semantics.
  • Define and check complex business rules (e.g., account overdraft protection logic) in a sandboxed, language-neutral format.
  • Build policy-as-code systems where non-developers can write safe, auditable expressions for infrastructure or application decisions.

Worth the install?

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

Parses and evaluates Google Common Expression Language (CEL) expressions in Python, enabling secure policy evaluation and cross-platform expression interoperability without requiring full Python execution.

Yes, if you need to evaluate untrusted or policy-defined expressions safely without exposing Python's full execution model. The low install friction and lack of known vulnerabilities are positives. However, the aging maintenance status (195 days since last release) and unclear license require verification before production use. Suitable for embedded policy evaluation; less suitable if you need active upstream support.

Install

cel-python on PyPI

pip

pip install cel-python

uv

uv add cel-python

poetry

poetry add cel-python

Installing cel-python

Before you install

Low install friction with six runtime dependencies bundled as a wheel. Maintenance status is aging—last release was 195 days ago—but the package remains in Beta and supports current Python versions (requires Python 3.10+).

License in practice

License treatment is unclear; no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms before use in proprietary or copyleft-sensitive projects.

Quickstart

import cel-python
env = Environment()
ast = env.compile('account.balance >= 500')
prgm = env.program(ast)
result = prgm.evaluate({'account': json_to_cel({'balance': 600})})

Requires Python 3.10 or later.

Verify before relying

  • Whether the package is actively maintained or in maintenance-only mode given the 195-day gap since last release.
  • The actual license under which cel-python is distributed, since metadata shows no SPDX or raw license text.
  • Performance characteristics and scalability limits for large or complex CEL expressions in production use.
  • How type coercion and division semantics (truncating toward zero) affect real-world policy evaluation workflows.

Package facts

License not declared (unclear)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 6 — google-re2, jmespath, lark, pendulum, pyyaml, tomli
Maintenance aging — 195 days since the last release
First released
Downloads 6,706,378/month — #1,867 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: cel_python-0.5.0-py3-none-any.whl

Development Status :: 4 - BetaProgramming Language :: Python

Tags

CEL expression evaluatorcommon expression language pythonpolicy expression evaluationsecure expression sandboxcross-platform expression languageCEL parser and runtimeexpression policy engine
expression-languagepolicy-enginesandboxed-evaluation

More Software Development packages