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

Stub handling for type check purposes #8521

Open
abianco88 opened this issue Oct 18, 2022 · 1 comment
Open

Stub handling for type check purposes #8521

abianco88 opened this issue Oct 18, 2022 · 1 comment

Comments

@abianco88
Copy link

Feature request

I'm following up on this comment from a member of the Pylance team. As you can see from the screenshot below, Pylance doesn't recognize the Numba List type because it it isn't re-exported from numba.typed. It would be nice if the Numba types were automatically recognized by a type checker, so I'm asking if the stubs could be written in a way to make this possible.

image

@stuartarchibald
Copy link
Contributor

Thanks for opening this request @abianco88. I took a look at the numba.typed module in question and now recall that the List and Dict re-exports are done under PEP-562. This "delayed" import was added in #6948 so as to prevent compilation from occurring at import time which obviously would slow down importing Numba.

I'm not sure with how type checking works with respect to PEP-562, but understanding that might help fix it. I suppose two immediate options are:

  1. Redesign the typed container modules so as to push the delayed import further down the import chain so that type checking "just works".
  2. Supply separate stubs.

This issue will be raised at the maintainer triage/public Numba meetings next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants