Skip to content

Alternative to nest-asyncio: threading #135

@davidbrochart

Description

@davidbrochart

Because nbclient's code is natively asynchronous, we provide wrappers to run async code synchronously for its blocking API. We currently use nest-asyncio to run coroutines until they complete in the current event loop (here). While this works well most of the time, it also comes with limitations, because nest-asyncio patches asyncio's code. I don't think it would work if someone decided to use uvloop for instance.
One alternative is to run coroutines in an event loop running in another thread. @SylvainCorlay experimented with it in #113, and fsspec also uses this approach here. I think we should provide a way to choose between nest-asyncio and the threading solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions