Skip to content

Releases: hardbyte/python-common-expression-language

v0.5.6

08 Feb 02:59
9d873f2

Choose a tag to compare

What's Changed

  • Fix mapping conversion for dict subclasses by @hardbyte in #29

Full Changelog: v0.5.5...v0.5.6

v0.5.5

07 Feb 08:16

Choose a tag to compare

Highlights

  • Upgrade to cel‑rust 0.12.0 (bytes feature enabled)
  • New compile() API + Program.execute() for fast repeated evaluation
  • New OptionalValue wrapper to represent CEL optional values in Python (preserves optional.none() vs optional.of(null))

Added

  • Compile/execute performance benchmark: examples/performance/compile_execute_benchmark.py
  • OptionalValue docs and examples

Notes

  • Optional values now surface as cel.OptionalValue instead of debug strings.
  • Performance guidance updated with compile/execute examples.

New Contributors

Full Changelog: v0.5.3...v0.5.5

v0.5.3: Add substring() function to stdlib and improve logging (#21)

14 Oct 00:28
d18ff9e

Choose a tag to compare

  • Added stdlib in Python to add functions before they land upstream. Added substring
  • removed warning level logging in cel crate

v0.5.1

11 Aug 10:27

Choose a tag to compare

✨ Added

  • EvaluationMode enum: Control type handling behavior in CEL expressions
    • EvaluationMode.PYTHON (default for Python API): Python-friendly type promotions
    • EvaluationMode.STRICT (default for CLI): Strict CEL type rules with no coercion
  • Type checking support: Added complete type stub files (.pyi) for PyO3 extension

v0.5.0: Release/0.5.0 (#8)

08 Aug 09:18
5f9b38d

Choose a tag to compare

🚨 Breaking Changes (Rust API only)

  • Upgraded cel crate (formerly cel-interpreter) 0.10.0 → 0.11.0:
    • Function registration now uses IntoFunction trait.
    • Python integration updated to use Arguments extractor for variadic args.
    • Imports renamed from cel_interpreter:: to cel::.
    • No changes to Python API – all existing code continues to work.

✨ Changed

  • Internal: Refactored Python integration to match new CEL API.
  • Updated dependencies:
    • pyo3: 0.25.0 → 0.25.1
    • pyo3-log: 0.12.1 → 0.12.4

🗒 Maintainer Notes

  • Prepared for upcoming CEL Rust features:
    • Enhanced type system & introspection
    • type() function support
    • Optional value handling

v0.4.1

01 Aug 23:42

Choose a tag to compare

Pygments Warning in CLI Fixed

CLI REPL syntax highlighting now works without warnings

v0.4.0

01 Aug 20:53

Choose a tag to compare

🚀 CLI Interface

  • Command-line tool: cel command now available after installation
  • Interactive REPL: Enhanced terminal experience with syntax highlighting, auto-completion, and command history
  • Multiple output formats: JSON, pretty tables, Python repr, and auto-detection
  • File processing: Batch evaluation of expressions from files
  • Context loading: JSON context files for complex evaluations

Command-line usage

$ cel '1 + 2'                           # → 3
$ cel --interactive                     # Launch REPL
$ cel 'age >= 21' --context user.json  # Context from file

🧪 Testing

  • 200+ tests: Complete coverage of all CEL features and edge cases
  • 35 new CLI tests: Formatter, REPL, file operations, and integration testing
  • Performance verification: Microsecond-level evaluation benchmarks
  • Error handling tests: Parser errors, type errors, and edge cases

🔧 Technical Improvements

CEL Interpreter Update

  • cel-interpreter: 0.9.0 → 0.10.0 (enhanced CEL specification compliance)

PyO3 0.25.0 Migration

  • Modern API: Migrated from deprecated IntoPy to IntoPyObject<'py> trait
  • Better error handling: Improved type conversion with proper lifetime management
  • Enhanced type safety: New conversion system with comprehensive error propagation
  • Graceful degradation: Parser panics converted to proper PyValueError exceptions

Documentation

  • Comprehensive Python-facing documentation with examples and type hints
  • Context class: Detailed docstrings for all methods with usage examples

📦 Dependencies

  • pyo3: 0.22.6 → 0.25.0
  • cel-interpreter: 0.9.0 → 0.10.0
  • log: 0.4.22 → 0.4.27
  • chrono: 0.4.38 → 0.4.41
  • pyo3-log: 0.11.0 → 0.12.1

Full Changelog: v0.3.1...v0.4.0

v0.3.1

20 Nov 10:51

Choose a tag to compare

Bug fix - support None values

v0.3.0

15 Nov 01:47

Choose a tag to compare

Adds supports for CEL expressions to use user defined Python Functions.

from cel import evaluate

def is_adult(age):
    return age > 21

evaluate("is_adult(age)", {'is_adult': is_adult, 'age': 18})
# False

Also updates pyo3 and cel-interpreter to latest stable versions.

Update to CEL v0.8.1

04 Nov 09:39
82b0f9e

Choose a tag to compare

from cel import evaluate

expression = "age > 21"
result = evaluate(expression, {"age": 18})
print(result)  # False

evaluate("start_time + duration('1h')", {'start_time': datetime.datetime.now()})