Numba User Survey 2024

Dear everyone,

as the Numba project continues to grow and thrive, we would like to learn more about our community, uses-cases and what is important to community members. Thus, you are all cordially invited to participate in the Numba User Survey 2024. :tada::tada::tada:

Please point your browsers at:

Lastly, If you have any questions, please feel free to comment below and thank you in advance for your participation! :sparkles::pray:

esc

3 Likes

@esc ,
In the Numba survey, there was a question regarding the features that you find important. One of them was โ€œGet Numba signatures from Python type annotations.โ€

If I understand the concept correctly, this feature is closely linked with ahead-of-time compilation and explicit caching. I assume this feature could make Numba type hinting redundant.
A critical condition for its implementation would be enabling numpy typing to specify array dimensions. This will hopefully be possible in future numpy versions.

The idea would be that Numba could automatically infer signatures from Python type annotations and apply them automatically, which would be an excellent addition.
Is this the case?

# ***************************************************************************
# Present
# ***************************************************************************
import numpy as np
from numpy.typing import NDArray
from numba.pycc import CC

type ArrFloat = NDArray[np.float32] | NDArray[np.float64]

cc = CC('my_module')

@cc.export('mult2df64', 'float64[:,:](float64[:,:], float64[:,:])')
@cc.export('mult2df32', 'float32[:,:](float32[:,:], float32[:,:])')
@cc.export('mult1df64', 'float64[:](float64[:], float64[:])')
@cc.export('mult1df32', 'float32[:](float32[:], float32[:])')
def mult(a: ArrFloat, b: ArrFloat) -> ArrFloat:
    return a * b

if __name__ == "__main__":
    cc.compile()

# ***************************************************************************
# Future (Get Numba signature from Python type annotations)
# ***************************************************************************
import numpy as np
from numpy.typing import NDArray
from numba import aot
aot.infer_python_signature = True

type Float = np.float32 | np.float64
type ArrFloat = NDArray[Float, ndim=1] | NDArray[Float, ndim=2]

@aot
def mult(a: ArrFloat, b: ArrFloat) -> ArrFloat:
    return a * b

if __name__ == "__main__":
    aot.compile()

@Oyibo yes, that is indeed the case. The narrative here is that, since Python is now equipped with typing abilities, it would be quite neat for Numba to leverage those.

1 Like

Also: Infer Numba Types from Python Type Hints ยท Issue #9475 ยท numba/numba ยท GitHub

Thank you everyone, this survey is now closed.

A new thread is made for the results: Numba User Survey 2024 Results