NumPy relies on bundled .pyi stubs for static typing. They live side-by-side with the .py (if they exist). See e.g. https://github.com/numpy/numpy/tree/main/numpy.
NumType is a static-typing project that we are developing. It comes with (different) numpy-stubs stubs-only package for numpy. It is a backwards-incompatible rework of the stubs that are bundled with numpy containing experimental new features, and will therefore be opt-in (once released).
If both numpy and NumType's numpy-stubs are installed, PEP 561 states that numpy-stubs should take precedence over the ones from numpy. Mypy does this the other way around, effectively ignoring the new numpy-stubs.
This effectively means that we currently cannot support mypy. So I consider this to be a big problem.
The only workaround I was able find is to delete all .pyi in the local numpy installation directory. But this isn't something we can realistically ask of our users.
So if any other workarounds come to mind, please let me know :)
Repro-repo with additional details
https://github.com/jorenham/mypy-pep561-numpy-issue.
NumPy relies on bundled
.pyistubs for static typing. They live side-by-side with the.py(if they exist). See e.g. https://github.com/numpy/numpy/tree/main/numpy.NumType is a static-typing project that we are developing. It comes with (different)
numpy-stubsstubs-only package fornumpy. It is a backwards-incompatible rework of the stubs that are bundled withnumpycontaining experimental new features, and will therefore be opt-in (once released).If both
numpyand NumType'snumpy-stubsare installed, PEP 561 states thatnumpy-stubsshould take precedence over the ones fromnumpy. Mypy does this the other way around, effectively ignoring the newnumpy-stubs.This effectively means that we currently cannot support mypy. So I consider this to be a big problem.
The only workaround I was able find is to delete all
.pyiin the local numpy installation directory. But this isn't something we can realistically ask of our users.So if any other workarounds come to mind, please let me know :)
Repro-repo with additional details
https://github.com/jorenham/mypy-pep561-numpy-issue.