Releases: hardbyte/python-common-expression-language
Releases · hardbyte/python-common-expression-language
v0.5.3: Add substring() function to stdlib and improve logging (#21)
v0.5.1
✨ Added
- EvaluationMode enum: Control type handling behavior in CEL expressions
EvaluationMode.PYTHON(default for Python API): Python-friendly type promotionsEvaluationMode.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)
🚨 Breaking Changes (Rust API only)
- Upgraded
celcrate (formerlycel-interpreter) 0.10.0 → 0.11.0:- Function registration now uses
IntoFunctiontrait. - Python integration updated to use
Argumentsextractor for variadic args. - Imports renamed from
cel_interpreter::tocel::. - No changes to Python API – all existing code continues to work.
- Function registration now uses
✨ 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
v0.4.0
🚀 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
v0.3.0
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})
# FalseAlso updates pyo3 and cel-interpreter to latest stable versions.
Update to CEL v0.8.1
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()})