Closed ghutchis closed 5 months ago
Thank you very much for reporting this.
I have to check if I can just change to numba.jit
or if I relied on the overloading and it requires deeper architectural changes.
A proper fix is is doable without architecture changes by following the instructions in your supplied link.
I will not do it yet though, because the use of isinstance
inside a jit
ted function is still an experimental feature.
Even in numba 0.57 I get a
NumbaExperimentalFeatureWarning: Use of isinstance() detected. This is an experimental feature.
warning.
I don't want to break with earlier versions, where generated_jit
is not yet deprecated, while a jitted isinstance
is not yet supported, if it is not clear that jitted isinstance
will become the correct replacement.
As soon as a clear successor of generated_jit
emerges, I will switch.
For example their code:
@njit # NOTE: standard @njit decorator.
def select(x):
if isinstance(x, float):
return x + 1
elif isinstance(x, str):
return x + " the number one"
else:
raise TypeError("Unsupported Type")
@njit
def foo(x):
return select(x)
print(foo(1.))
print(foo("a string"))
throws a warning about isinstance
being experimental. So I will have replaced one warning with another warning.
I have numba version 0.59.0 where this now stops with an error:
>>> import chemcoord as cc
[...truncated...]
chemcoord/cartesian_coordinates/_cart_transformation.py", line 6, in <module>
from numba import jit, generated_jit
ImportError: cannot import name 'generated_jit' from 'numba'
This is consistent with the information
Removal took place in version 0.59.0.
at https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-generated-jit
isinstance
seems to be okay, the demo at this web page works.
Sorry for answering so late to this issue. I was quite occupied with my defense two days ago. Now I am free again to do software maintenance and will take care of it. (In the case that you already fixed it yourself, I am also happily accepting PRs.)
Solved now
Running the code with current numba yields the following warnings: