Does numba support lists of grpc objects?

I would like to use numba to speed up some operations involving grpc objects. My understanding is that c code is generated for the grpc types. Is this a reasonable use case for numba? What is this error message telling me? A trivially simple example is:

import numba
from google.protobuf import timestamp_pb2 as tspb


@numba.njit()
def foo(x):
    return len(x)


foo([tspb.Timestamp()])

The error is:

- argument 0: Cannot type list element type <class 'google.protobuf.timestamp_pb2.Timestamp'>

Note that in some of the “real” code, instead of lists the type is google.protobuf.pyext._message.RepeatedCompositeContainer, which IIUC is roughly an alternate list implementation in C. That error message is:

- argument 0: Cannot determine Numba type of <class 'google.protobuf.pyext._message.RepeatedCompositeContainer'>

I am using numba 0.56.0 and grpcio-tools 1.45.0.

Thank you

@mattharrigan thank you for asking about this. Numba only supports a subset of Python and NumPy. The error you are seeing is because Numba can’t compile grpc objects.

Numba does have APIs to extend its support to other types, though: Extending Numba — Numba 0.56.0+0.gf75c45a8d.dirty-py3.7-linux-x86_64.egg documentation

Perhaps there is scope to generate / write an extension that works with the layour of your grpc objects so that Numba can compile code operating on them.