Skip to content
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

support 'synchronous' code with a fake loop #113

Closed
graingert opened this issue Jul 24, 2017 · 1 comment
Closed

support 'synchronous' code with a fake loop #113

graingert opened this issue Jul 24, 2017 · 1 comment

Comments

@graingert
Copy link
Contributor

graingert commented Jul 24, 2017

add support for a mode where every Future completes synchronously.

This way someone could write an adapter that can use one of twisted.web, requests or aiohttp and still get back a future.

Client library code would use this adapter as if it were twisted.web, except if you used requests the library could provide results synchronously by querying a special property on the txaio Future.

@meejah
Copy link
Contributor

meejah commented Aug 31, 2017

The right answer for this under Twisted is "use Crochet" (https://pypi.python.org/pypi/crochet). I don't know if there's a similar thing for asyncio.

Also, txaio isn't really for "client" applications -- it's for libraries to reduce the amount of code required to present a "twisted" or an "asyncio" API to users. However, users of this library still have to choose one or the other. So, if they chose "Twisted" but wanted synchronous code they'd just use Crochet.

@meejah meejah closed this as completed Aug 31, 2017
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

No branches or pull requests

2 participants