Skip to content

feat(python): bind pairwise streams - #885

Open
maxi-maxima wants to merge 2 commits into
wingfoil-io:mainfrom
maxi-maxima:agent/python-pairwise
Open

feat(python): bind pairwise streams#885
maxi-maxima wants to merge 2 commits into
wingfoil-io:mainfrom
maxi-maxima:agent/python-pairwise

Conversation

@maxi-maxima

Copy link
Copy Markdown
Contributor

Closes #882

What changed

  • add a hand-written PyStream::pairwise binding that keeps the previous PyElement as resettable engine state
  • emit a real Python 2-tuple from the second tick onward, so pairwise().split() composes without another conversion path
  • expose the fluent Python Stream.pairwise() method and document it beside difference()
  • add Rust seam and pytest regressions using non-arithmetic string values; both pin the quiet first tick and the split round trip

Why

The Rust pairwise op already reaches all three engines, but its typed (T, T) output cannot pass through the ordinary erased #[pyop] route as one PyElement. The Python binding therefore needs the same state machine at the erased edge and must explicitly materialize a Python tuple.

Validation

  • cargo fmt --all -- --check
  • cargo metadata --no-deps --format-version 1
  • git diff --check
  • python -m py_compile crates/wingfoil-python/tests/test_interop.py
  • checked the tuple construction against the vendored PyO3 0.29.1 API

The Rust lint/test commands and maturin develop && pytest cannot start on this Windows host because the MSVC linker (link.exe) is not installed. The PR is draft so the upstream Linux checks can provide the executable validation before it is marked ready.

Comment thread crates/wingfoil-python/src/graph.rs Fixed
Comment thread crates/wingfoil-python/src/graph.rs Fixed
Comment thread crates/wingfoil-python/src/graph.rs Fixed
Comment thread crates/wingfoil-python/src/graph.rs Fixed
Comment thread crates/wingfoil-python/src/graph.rs Fixed
@maxi-maxima
maxi-maxima marked this pull request as ready for review August 19, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bind pairwise() in wingfoil-python

2 participants