Skip to content

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