Skip to content

Proof of concept for async pipe #252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

edmundmills
Copy link

This PR creates an async_pipe that works with coroutines. It can be passed either synchronous or asynchronous functions as arguments, and calls them sequentially on the input, awaiting the coroutines appropriately.

The async_pipe uses inspect.iscoroutine to determine whether results should be awaited. An earlier version used inspect.isawaitable, but this did not work with the Result world, since Results are awaitable. The same would be true for Options.

It also includes an extra bind function for async_result that can be used in the async_pipeline.

I would personally find this functionality helpful for integrating with existing code that uses the standard python approach to async.

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.

1 participant