Skip to content

np.ufunc type stubs (threading functions and PyUFunc_*) - #10739

Merged
swap357 merged 1 commit into
numba:mainfrom
jorenham:typing/np.ufunc/threading-functions
Sep 4, 2026
Merged

swap357 merged 1 commit into
numba:mainfrom
jorenham:typing/np.ufunc/threading-functions

Conversation

@jorenham

@jorenham jorenham commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

A quick code search showed that these threading functions (documented in https://numba.readthedocs.io/en/stable/user/threading-layer.html) are used quite a lot, so I figured it'd help to stub them.

These threading functions actually live in numba.np.ufunc.parallel. But that module also contains a bunch of publically-named undocumented functions and classes. If I would've stubbed that module directly, then stubtest would've required me to stub everything there, which seemed like a waste of time.
These functions are re-exported in __init__.py , so it's a lot easier to place the stubs in this __init__.pyi. However, because this __init__.py also re-exports some constants from the C-extension module numba.np.ufunc._internal, I also had to stub these constants.

Anway, the stubs themselves are all very straightforward stuff.

Note that the vectorize/guvectorize re-exports here are not yet typed, see #10715. It's fine to merge this before, though.

@jorenham jorenham changed the title np.ufunc type stubs (threading functions and PyUFunc_* constants) np.ufunc type stubs (threading functions and PyUFunc_*) Jul 29, 2026
@swap357 swap357 added skip_release_notes Skip towncrier requirement 3 - Ready for Review labels Jul 30, 2026

@swap357 swap357 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thank you!

@swap357
swap357 merged commit bb3626a into numba:main Sep 4, 2026
25 of 26 checks passed
@swap357 swap357 added 5 - Ready to merge Review and testing done, is ready to merge and removed 3 - Ready for Review labels Sep 4, 2026
@jorenham
jorenham deleted the typing/np.ufunc/threading-functions branch September 4, 2026 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to merge Review and testing done, is ready to merge skip_release_notes Skip towncrier requirement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants