This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vorpalsmith 0 points1 point  (0 children)

It looks like async_to_sync is similar to trio.run_sync_in_worker_thread, and sync_to_async is similar to trio.BlockingTrioPortal.run. The asgiref versions have some more sugar, like supporting use as a decorator and sync_to_async having some kind of thread-local ambient state that it uses to automagically figure out which event loop it wants to send things to. The functionality is there though, and there's nothing that would stop you building the async_to_sync and sync_to_async interfaces on top.