Skip to content

Decide and stick once and for all if functions are async or not ? #1165

Open
@Carreau

Description

@Carreau

Description

Right now I'm starting to have problem with mypy/async and sync,
a couple of functions like km.start_kernel/ks._async_start_kernel are sync/async in upstream jupyter_client, but there are places where there is start_kernel = _async_start_kernel, where upstream it's explicitly start_kernel = run_sync(_async_start_kernel). Now it's problematic as you can't swap one class for the other and mypy complain because:

  1. obviously if someone expect a sync method and call an async one, it's won't get run.
  2. if someone expect an async and we await a sync method you get error like "str is not an awaitable".

So right now in #1100, I can't fix mypy by correcting start_kernel = _async_start_kernel to start_kernel = run_sync(_async_start_kernel), because then a bunch of test are failing,
and can't leave it as is, as it's incorrect WRT jupyter_client.

One possible change is to update jupyter_client to make start_kernel always async ?

I'm not sure which direction to go anymore.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions