Repository navigation
feat: add apipe for sequential asynchronous pipelines - #252
Merged
Merged
Conversation
dbrattli
requested changes
Aug 15, 2026
dbrattli
left a comment
Owner
There was a problem hiding this comment.
Thanks for the proof of concept. Before it can be reconsidered, please rebase onto current main and address these blockers:
extra.async_result.bindaccepts a mapper returningResult[_TResult, Any]but promisesResult[_TResult, _TError]. That is type-unsound: a mapper may introduce a different error type undetected. Preserve_TErrorin the mapper return type and useAwaitablerather than the overly specificCoroutine.async_piperecursively calls itself once per pipeline stage, so a sufficiently long valid runtime pipeline raisesRecursionError. Implement the execution loop iteratively while retaining the deliberateiscoroutinebehavior that avoids awaitingOptionandResult.
Please add tests for error-type preservation and a pipeline longer than Python’s recursion limit; then CI can validate the rebased implementation.
dbrattli
approved these changes
Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
apipefor pipelines that mix synchronous functions and coroutine-returning functions:Execution starts when awaited and proceeds sequentially. Native coroutine inputs and stage outputs are awaited once;
Option,Result, tasks, futures, and custom awaitables remain values. Use an async wrapper to resolve other awaitables. Existingpipesemantics are unchanged.Expose
apipefromexpressionandexpression.core. Addexpression.extra.async_result.bindfor asynchronous Result mapping with a preserved error type. Execution is iterative, and exceptions and cancellation propagate without running later stages. A Result bind overload supports composition over the whole Result union while preserving case-specific typing.Based on Edmund Mills (@edmundmills)'s original proof of concept, retained as commit e7024cf. Follow-up commits merge current main, rename the proposed
async_pipeAPI toapipe, address the review findings, and add documentation and runtime/type regressions.Validation commands (in the project environment):
pytestpre-commit run --all-files