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
Add support for other async frameworks #77
Comments
Also, this looks super interesting! ❤️ I've felt the pain of trying to use the existing awkward, low-level apis so I'm very keen to give |
That sounds great, I think we should be able to swap anyio in. |
Looking more into this it may be more complex than I first assumed, we currently depend on I think I would need to replace |
Hmm, right 🤔
I'm not sure about the others, but will have a poke around to see what I can find out... |
I asked the experts on gitter. It seems you might be able to get away with using AnyIO's native cancellation handling rather than Regarding def register_async_exit(callback):
if sniffio.current_async_library() == "asyncio":
import asyncio_atexit
asyncio_atexit.register(callback)
else:
@trio.lowlevel.spawn_system_task
async def cleanup_task():
try:
await trio.sleep_forever()
finally:
result = callback()
if inspect.isawaitable(result):
with trio.move_on_after(5) as scope:
scope.shield = True
await result
|
Thanks @dhirschfeld this is really helpful. I like the idea of using the timeouts from We use |
Quick update here. The core of I also want to rename |
Sounds great! ❤️ I'm not sure if naming a module |
Ok fair enough, in that case I think I'll just leave it as |
Ok |
Which project are you requesting an enhancement for?
kr8s
What do you need?
Rather than directly using
asyncio
primitives which preclude the use of other async framweorks it would be great ifkr8s
could utiliseanyio
instead so that users are free to use the async framework of their choice in their applications.Tasks
aiohttp
withhttpx
#102aiohttp
tohttpx
#104kr8s._io
withanyio
#88aiofiles
withanyio
's file IO #84async-timeout
withanyio
's native cancellation #87kr8s._io.check_output
toanyio
#332asyncio.sleep
andasyncio.gather
withanyio
#331The text was updated successfully, but these errors were encountered: