Skip to content

Commit 48a2f21

Browse files
authored
Add sum() to the extended stdlib, refresh dependencies and modernise CI (#39)
Closes #14 by adding `sum` to cel.stdlib's core library (Kubernetes list-library semantics: int/uint/double plus duration, sum([]) == 0, bools rejected, no mixing of numbers and durations), and documents why fold/reduce must come from cel-rust instead: functions receive evaluated arguments, and the comprehension macros are expanded by the parser from a fixed, non-extensible table. Dependencies refreshed within their existing ranges (cel 0.14.3, PyO3 0.29.2, regex 1.13.1, serde 1.0.229, serde_json 1.0.151, thiserror 2.0.20, uuid 1.24.1), with uv.lock now committed so CI resolves what local development does. CI: adds Python 3.13 and 3.14, pins ruff to the 0.16 line and excludes Markdown from the formatter (ruff 0.16 began formatting docs code blocks, which would have failed the lint job on the next push to main), moves the security scan to `uvx safety scan`, and updates claude-code-action from @beta to @v1. Also documents the Python callback boundary's two lossy conversions — uint returns as int, durations are microsecond-resolution — with tests pinning both.
1 parent bc21129 commit 48a2f21

14 files changed

Lines changed: 1469 additions & 113 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: ubuntu-latest
2525
strategy:
2626
matrix:
27-
python-version: ["3.11", "3.12"]
27+
python-version: ["3.11", "3.12", "3.13", "3.14"]
2828
steps:
2929
- uses: actions/checkout@v5
3030

.github/workflows/claude.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fetch-depth: 1
3131

3232
- name: Run Claude PR Action
33-
uses: anthropics/claude-code-action@beta
33+
uses: anthropics/claude-code-action@v1
3434
with:
3535
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
3636
# Or use OAuth token instead:

.github/workflows/security.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ jobs:
4242
run: uv sync --dev
4343

4444
- name: Run Python security scan
45-
run: |
46-
uv add --dev safety
47-
uv run safety check --ignore 70612
45+
# `safety check` is retired in favour of `safety scan`; run it with uvx so
46+
# the scanner is not added to this project's dev dependencies.
47+
run: uvx safety scan --detailed-output
4848
continue-on-error: true # Don't fail CI on security advisories, just report
4949

5050
codeql:

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ htmlcov/
88
# Rust
99
target/
1010

11-
# UV
12-
uv.lock
13-
1411
# Project specific
1512
site/
1613
*.so

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- `cel.stdlib`'s `core` library gains `sum`, completing the aggregation trio
13+
(`min`, `max`, `sum`) requested in
14+
[#14](https://github.com/hardbyte/python-common-expression-language/issues/14).
15+
It follows Kubernetes' CEL list library: `int`, `uint`, `double` and `duration`
16+
are supported; `sum([])` is `0`; booleans are rejected rather than counted as
17+
`1`/`0`; numbers and durations cannot be mixed. As with every `cel.stdlib`
18+
function, results cross the Python callback boundary, so a `uint` sum returns
19+
an `int` and durations are microsecond-resolution — both now documented. As with the rest of the
20+
extended stdlib it works in both call forms — `sum([1, 2, 3])` and
21+
`items.map(i, i.weight).sum()`.
22+
`fold`/`reduce` remain unavailable: they need a parser-level comprehension
23+
macro, which has to come from [cel-rust](https://github.com/cel-rust/cel-rust)
24+
rather than this wrapper.
25+
26+
### Updated
27+
28+
- Refreshed the locked Rust dependencies within their existing ranges: cel
29+
0.14.0 to 0.14.3, PyO3 0.29.0 to 0.29.2, plus transitive bumps (regex 1.13.1,
30+
serde 1.0.229, serde_json 1.0.151, thiserror 2.0.20, uuid 1.24.1).
31+
- `uv.lock` is now committed so CI resolves the same Python dependencies as
32+
local development; refresh it with `uv lock --upgrade`.
33+
- CI tests Python 3.13 and 3.14 in addition to 3.11 and 3.12.
34+
- Pinned ruff to the 0.16 line and excluded Markdown from `ruff format`, so
35+
formatter releases no longer change what CI expects of the docs.
36+
- The security workflow runs `safety scan` via `uvx` (the retired `safety check`
37+
command no longer works, and the scanner is no longer added to this project's
38+
dev dependencies), and the Claude workflow uses
39+
`anthropics/claude-code-action@v1` instead of the deprecated `@beta` tag.
40+
1041
## [0.7.0] - 2026-07-04
1142

1243
Upgrades to cel-rust 0.14, ships an extended standard library that mirrors

0 commit comments

Comments
 (0)