Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .zed/rules
Original file line number Diff line number Diff line change
Expand Up @@ -822,15 +822,15 @@ convenient call and pod.process(a, b) the exact primitive:
must equal those of a pipeline with that select written by hand (the stream's
`select_data_columns` method builds the same operator, and `a.join(b)` the same `Join`).
Nothing to drop means no step. One info log names the dropped columns; it is not a warning.
- pod(a, b, strict=True) and pod.process(a, b) reject an extra column. strict is part of
no identity. process never takes a strict argument and never drops a column.
- pod(a, b, strict_columns=True) and pod.process(a, b) reject an extra column.
strict_columns is part of no identity. process always uses the exact column contract.
- A missing required column is an error in every form. Tags are never dropped. A data column
shared by two inputs fails at the join, used or not: no special handling.
- No select is added when the data function's accepts_arbitrary_keywords is true (no kind
today; PythonDataFunction rejects variadic keyword arguments).
- Function pods only. An operator's and a SideEffectPod's __call__ stay aliases of
process with no strict argument. There is no global setting.
- A test of the exact input contract uses process or strict=True.
process with no strict_columns argument. There is no global setting.
- A test of the exact input contract uses process or strict_columns=True.

Operator (core/operators/) — structural pod transforming streams without adding or
synthesizing data; it may add a tag (AddTags). All subclass StaticOutputPod:
Expand Down
8 changes: 4 additions & 4 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -837,15 +837,15 @@ convenient call and `pod.process(a, b)` the exact primitive:
must equal those of a pipeline with that select written by hand (the stream's
`select_data_columns` method builds the same operator, and `a.join(b)` the same `Join`).
Nothing to drop means no step. One info log names the dropped columns; it is not a warning.
- `pod(a, b, strict=True)` and `pod.process(a, b)` reject an extra column. `strict` is part of
no identity. `process` never takes a `strict` argument and never drops a column.
- `pod(a, b, strict_columns=True)` and `pod.process(a, b)` reject an extra column.
`strict_columns` is part of no identity. `process` always uses the exact column contract.
- A missing required column is an error in every form. Tags are never dropped. A data column
shared by two inputs fails at the join, used or not: no special handling.
- No select is added when the data function's `accepts_arbitrary_keywords` is true (no kind
today; `PythonDataFunction` rejects `**kwargs`).
- Function pods only. An operator's and a `SideEffectPod`'s `__call__` stay aliases of
`process` with no `strict` argument. There is no global setting.
- A test of the exact input contract uses `process` or `strict=True`.
`process` with no `strict_columns` argument. There is no global setting.
- A test of the exact input contract uses `process` or `strict_columns=True`.

**Operator** (`core/operators/`) — structural pod transforming streams without adding or
synthesizing data; it may add a tag (`AddTags`). All subclass `StaticOutputPod`:
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ print(job.nodes["fahrenheit"].as_table().sort_by("experiment").to_pylist())
# [{'experiment': 'exp_001', 'temp_fahrenheit': 68.9}, {'experiment': 'exp_002', 'temp_fahrenheit': 72.14}]
```

A function pod drops unused data columns by default. Pass `strict_columns=True` to reject
them.

Add a row and run a new job over the same database. The two stored results are found again
by their input values, and only the new row is computed:

Expand Down
4 changes: 2 additions & 2 deletions changelog.d/ITL-1023.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@
holds the data-tag, and how to make the two agree: `tag_only_columns` on the
source, or a slot declared with the column in both roles (ITL-1142). The bind stays
strict.
- `pod.process(stream)` and `pod(stream, strict=True)` refusing a data-tag the
function does not read name the data-tags and the two ways out: `pod(stream)`,
- `pod.process(stream)` and `pod(stream, strict_columns=True)` refusing a data-tag
the function does not read name the data-tags and the two ways out: `pod(stream)`,
or `tag_only_columns`, each only where it can work (not when no data column of the
input is a parameter of the function, except a plain `FunctionPod`'s call).
- "Not supported with data-tags yet" names `tag_only_columns=True`, which keeps
Expand Down
5 changes: 5 additions & 0 deletions changelog.d/ITL-1585.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Breaking changes and migration

- Rename the function pod call keyword `strict` to `strict_columns`. Use
`pod(a, b, strict_columns=True)` to reject unused input data columns. By default,
the call still drops those columns with one automatic select.
2 changes: 1 addition & 1 deletion docs/concepts/data-tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ example a copy in the source's data under another name, or

## Errors that name a data-tag

- `pod.process(stream)` and `pod(stream, strict=True)` are exact: they hand every data
- `pod.process(stream)` and `pod(stream, strict_columns=True)` are exact: they hand every data
column to the function, so a data-tag the function does not read is refused like
any extra column. The error names the data-tags and the two ways out: call the
pod, `pod(stream)`, which for a plain `FunctionPod` lets them pass through as
Expand Down
12 changes: 6 additions & 6 deletions docs/concepts/function-pods.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ Each call that drops columns logs one message at `INFO` level (logger
value: a misspelt column (`Height` for a parameter `height=1.0`) is dropped like any other
unused column and the default is used, and that message is the only trace.

### Exact calls: `strict=True` and `.process()`
### Exact calls: `strict_columns=True` and `.process()`

To have an extra column rejected instead of dropped, pass `strict=True`, or call
To have an extra column rejected instead of dropped, pass `strict_columns=True`, or call
`.process()`, which is the exact primitive and never drops a column:

```python
try:
compute_bmi.pod(wide, strict=True)
compute_bmi.pod(wide, strict_columns=True)
except ValueError as err:
print(type(err).__name__)
# ValueError
Expand All @@ -182,9 +182,9 @@ The error message names both schemas and the first column that does not fit, for
compatible with expected input schema Schema({'weight': float, 'height': float}): column
'age' is not a parameter of the function`.

`strict` decides only whether an extra column is an error. It is not part of any hash: when
there is nothing to drop, `pod(stream)`, `pod(stream, strict=True)` and `pod.process(stream)`
build the same pipeline.
`strict_columns` controls whether an extra column is an error. When there is nothing to
drop, `pod(stream)`, `pod(stream, strict_columns=True)` and `pod.process(stream)` build
the same pipeline and produce identical hashes.

### What is an error in every form

Expand Down
2 changes: 2 additions & 0 deletions docs/dev/design_issues/ITL-807-F16.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ be dropped no step is added. One info message names the dropped columns. `strict
`process` reject an extra column as before; `strict` is in no identity. No select is added for
a data function whose `accepts_arbitrary_keywords` is true (none today). Operators and
`SideEffectPod` keep `__call__` as an alias of `process`.

ITL-1585 renamed the call keyword to `strict_columns`.
2 changes: 2 additions & 0 deletions docs/dev/plans/2026-11-12-itl-807-function-pod-auto-select.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Function pod `__call__` drops unused data columns (ITL-807, ITL-193) Implementation Plan

ITL-1585 renamed the function pod call keyword to `strict_columns`.

> **For agentic workers:** REQUIRED SUB-SKILL: Use sensei:subagent-driven-development (recommended) or sensei:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** `pod(a, b)` on a function pod drops the data columns the function does not take, by
Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def analyze_conditions(temperature: float, pressure: float) -> tuple[float, bool
- **Parameter names match data column names.** Each parameter takes the data column with
exactly its name, here `temperature` and `pressure`.
- **Data columns the function does not take are dropped** when you call the pod.
`pod(stream, strict=True)` and `pod.process(stream)` reject them instead (see
`pod(stream, strict_columns=True)` and `pod.process(stream)` reject them instead (see
[Function Pods](concepts/function-pods.md#input-columns)).
- **Type annotations define the schemas.** Orcapod uses them to build the output schema and
to validate compatibility when the pod is applied. A parameter without an annotation needs
Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ the message names the first offending column:
`pa.table(...)` without a schema has nullable columns.
- `column 'q' is not a parameter of the function`: the stream has a column the function
does not take. `pod(stream)` drops such columns for you (it adds a `SelectDataColumns`
step), so you see this only from `pod.process(stream)`, from `pod(stream, strict=True)`,
step), so you see this only from `pod.process(stream)`, from `pod(stream, strict_columns=True)`,
or when **no** column of the stream is a parameter.

**Fix.** For a missing column, rename with `stream.map_data({"old": "new"})`. For a type
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial/02-function-pods.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ print(units.drop_data_columns(["region", "n_spikes"]).keys())
!!! note "Why drop the other columns?"
Dropped columns are not part of the inputs Orcapod stores a result under. A change in an
unused column therefore does not make Orcapod compute the result again (Part 6 shows
this). To reject extra columns instead, pass `strict=True`:
`to_mm.pod(units, strict=True)` raises `ValueError`. See [Input columns](../concepts/function-pods.md#input-columns).
this). To reject extra columns instead, pass `strict_columns=True`:
`to_mm.pod(units, strict_columns=True)` raises `ValueError`. See [Input columns](../concepts/function-pods.md#input-columns).

## Returning more than one output

Expand Down
17 changes: 9 additions & 8 deletions src/orcapod/core/function_pod.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def _validate_input(self, tag_schema: Schema, data_schema: Schema) -> None:
raise ValueError(
f"{error}. {unread} are data-tags of the input (each a tag "
"and a data column of one name) that the function does not read, and "
"the exact form, pod.process(stream) or pod(stream, strict=True), "
"the exact form, pod.process(stream) or pod(stream, strict_columns=True), "
f"hands every data column to the function: {way_out}"
) from error
self._validate_output_keys(tag_schema.keys())
Expand Down Expand Up @@ -768,7 +768,7 @@ def __call__(
self,
*streams: StreamProtocol,
label: str | None = None,
strict: bool = False,
strict_columns: bool = False,
) -> StreamProtocol:
"""Apply the pod, dropping the data columns its function does not take.

Expand All @@ -784,22 +784,22 @@ def __call__(
Args:
*streams: Input streams to process.
label: Optional label for tracking.
strict: If ``True``, an extra data column is an error, as in
strict_columns: If ``True``, an extra data column is an error, as in
``process``. It decides only that; it is part of no identity.

Returns:
The resulting output stream.

Raises:
ValueError: If a parameter without a default has no column, a column's
type is incompatible with its parameter, or (``strict=True``) the
type is incompatible with its parameter, or (``strict_columns=True``) the
input carries a data column that is not a parameter.
"""
logger.debug("Invoking pod %s on streams through __call__: %s", self, streams)
# A function that accepts arbitrary keywords takes every column, so
# nothing is unused and no select is added (developer, November 12, 2026,
# ITL-807). No data function kind accepts them today.
if strict or self.data_function.accepts_arbitrary_keywords:
if strict_columns or self.data_function.accepts_arbitrary_keywords:
return self.process(*streams, label=label)

input_stream = self.handle_input_streams(*streams)
Expand Down Expand Up @@ -982,7 +982,7 @@ def __call__(
self,
*streams: StreamProtocol,
label: str | None = None,
strict: bool = False,
strict_columns: bool = False,
) -> FunctionPodStream:
"""Apply the pod, dropping the data columns its function does not take.

Expand All @@ -992,13 +992,14 @@ def __call__(
Args:
*streams: Input streams to process.
label: Optional label for tracking.
strict: If ``True``, an extra data column is an error, as in ``process``.
strict_columns: If ``True``, an extra data column is an error, as in ``process``.

Returns:
A ``FunctionPodStream`` wrapping the computation.
"""
return cast(
FunctionPodStream, super().__call__(*streams, label=label, strict=strict)
FunctionPodStream,
super().__call__(*streams, label=label, strict_columns=strict_columns),
)

def to_config(self) -> dict[str, Any]:
Expand Down
7 changes: 4 additions & 3 deletions tests/test_core/data_tags/test_error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_a_plain_mismatch_says_nothing_about_data_tags() -> None:
assert "data-tag" not in str(excinfo.value)


# ── pod.process and strict=True: the exact form (ITL-1022) ──────────────────
# ── pod.process and strict_columns=True: the exact form (ITL-1022) ──────────────────


@op.function_pod(output_keys=["half"])
Expand All @@ -148,8 +148,8 @@ def half(y: int) -> float:

@pytest.mark.parametrize(
"call",
[lambda s: half.pod.process(s), lambda s: half.pod(s, strict=True)],
ids=["process", "strict"],
[lambda s: half.pod.process(s), lambda s: half.pod(s, strict_columns=True)],
ids=["process", "strict_columns"],
)
def test_the_exact_form_names_unread_data_tags_and_the_ways_out(
call: Callable[[op.sources.DictSource], object],
Expand All @@ -159,6 +159,7 @@ def test_the_exact_form_names_unread_data_tags_and_the_ways_out(
_ = call(source)
message = str(excinfo.value)
assert "['x'] are data-tags of the input" in message
assert "pod(stream, strict_columns=True)" in message
assert "pod(stream) to let them pass through as data-tags" in message
assert "add ['x'] to the tag_only_columns of the source" in message

Expand Down
2 changes: 1 addition & 1 deletion tests/test_core/data_tags/test_function_pods.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_strict_call_is_process() -> None:
def double(t: int, amp: float) -> float:
return t * amp

strict = double.pod(_source(), strict=True)
strict = double.pod(_source(), strict_columns=True)
assert stream_data_tags(strict) == ()


Expand Down
Loading
Loading