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

Handle async do_complete. #520

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Nov 13, 2024

A number of methods of ipykernel can optinally return awaitable[T] instead of just T, this is the case for do_complete.

I think it's a mistake ; see ipython/ipykernel#1295 ; in particular because it's easy to forget / hard to properly type-check, and I'd like to make it mandatory in the long term to have await.

Spyder seem to not handle the case where do_completer return an awaitable (or more partiularly is do_complete is a coroutine function.

This tries to handle it – and as of course do_completer can be async, all caller must be async. So I try to do all the required updates.

Note: I also add explict imports in some test, to get better error message in case those deps are not installed.

A number of methods of ipykernel can optinally return `awaitable[T]`
instead of just `T`, this is the case for `do_complete`.

I think it's a mistake ; see ipython/ipykernel#1295 ; in particular
because it's easy to forget / hard to properly type-check, and I'd like
to make it mandatory in the long term to have await.

Spyder seem to not handle the case where do_completer return an
awaitable (or more partiularly is `do_complete` is a coroutine function.

This tries to handle it – and as of course `do_completer` _can_ be
async, all caller _must_ be async. So I try to do all the required
updates.

Note: I also add explict imports in some test, to get better error
message in case those deps are not installed.
@Carreau
Copy link
Contributor Author

Carreau commented Nov 13, 2024

This is more to start a discussion than a "this must be merged". It's mostly to start some discussion also with upstream as we sort of disagree that having def f(...): -> T | Awaitable[T] is a good thing.

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

Successfully merging this pull request may close these issues.

1 participant