What is the proper way to include a list of strings in a Numba jitclass? The documentation here is very limited and I am currently encountering DeprecationWarnings.
Should I use an array of strings instead?
For example:
import numpy as np
from numba.experimental import jitclass
from numba import types
spec = [
('datetime', types.NPDatetime('s')),
('strings', types.List(types.unicode_type)),
]
@jitclass(spec)
class DateTimeStringClass:
def __init__(self, datetime, strings):
self.datetime = datetime
self.strings = strings
# Example usage
datetime_obj = np.datetime64('2024-03-02 02:00:00')
string_list = ['string1', '323', 'string3']
obj = DateTimeStringClass(datetime_obj, string_list)
<string>:3: NumbaPendingDeprecationWarning:
Encountered the use of a type that is scheduled for deprecation: type 'reflected list' found for argument 'strings' of function 'DateTimeStringClass.__init__'.
For more information visit https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-reflection-for-list-and-set-types
File "<stdin>", line 3:
<source missing, REPL/exec in use?>
C:\numba\core\ir_utils.py:2172: NumbaPendingDeprecationWarning:
Encountered the use of a type that is scheduled for deprecation: type 'reflected list' found for argument 'strings' of function 'ctor'.
For more information visit https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-reflection-for-list-and-set-types
File "<string>", line 2:
<source missing, REPL/exec in use?>
warnings.warn(NumbaPendingDeprecationWarning(msg, loc=loc))