TypeError: Parameters to generic types must be types. Got Ellipsis. in asynchro.py
Closed this issue · 4 comments
I'm using Python 3.9.13 and trulens-eval==0.21.0 and by simply calling from trulens_eval import Tru
i got the error
TypeError: Parameters to generic types must be types. Got Ellipsis.
from trulens_eval/utils/asynchro.py:68. Using trulens-eval==0.20.3 does not yielding to that error.
Only executing this code, which should be similar to your implementation, yields to the respective error:
from typing import Callable, Awaitable, Union, TypeVar
A = TypeVar("A")
B = TypeVar("B")
T = TypeVar("T")
CallableMaybeAwaitable = Union[Callable[[A], B], Callable[[A], Awaitable[B]]]
CallableMaybeAwaitable = Callable[..., Awaitable[T]]
CallableMaybeAwaitable[..., T]
TypeError Traceback (most recent call last)
Cell In[17], line 1
----> 1 CallableMaybeAwaitable[..., T]
File ~\\AppData\\Local\\Programs\\Python\\Python39\\lib\\typing.py:277, in _tp_cache.<locals>.decorator.<locals>.inner(*args, **kwds)
275 except TypeError:
276 pass # All real errors (not unhashable args) are raised below.
--> 277 return func(*args, **kwds)
File ~\\AppData\\Local\\Programs\\Python\\Python39\\lib\\typing.py:767, in _GenericAlias.__getitem__(self, params)
765 params = (params,)
766 msg = \"Parameters to generic types must be types.\"
--> 767 params = tuple(_type_check(p, msg) for p in params)
768 _check_generic(self, params, len(self.__parameters__))
770 subst = dict(zip(self.__parameters__, params))
File ~\\AppData\\Local\\Programs\\Python\\Python39\\lib\\typing.py:767, in <genexpr>(.0)
765 params = (params,)
766 msg = \"Parameters to generic types must be types.\"
--> 767 params = tuple(_type_check(p, msg) for p in params)
768 _check_generic(self, params, len(self.__parameters__))
770 subst = dict(zip(self.__parameters__, params))
File ~\\AppData\\Local\\Programs\\Python\\Python39\\lib\\typing.py:166, in _type_check(arg, msg, is_argument, module, allow_special_forms)
164 return arg
165 if not callable(arg):
--> 166 raise TypeError(f\"{msg} Got {arg!r:.100}.\")
167 return arg
TypeError: Parameters to generic types must be types. Got Ellipsis.
@piotrm0 can you take a look at this?
@JEwerszumrode - this should be fixed by #840 now merged into main. Please try installing from GitHub and let us know if this issue is resolved.
You can install the latest version from GitHub with the following commands:
pip uninstall trulens_eval -y # to remove existing PyPI version
pip install git+https://github.com/truera/trulens#subdirectory=trulens_eval
Missed some ellipses in earlier fix. Try this branch instead of current main:
pip uninstall trulens_eval -y # to remove existing PyPI version
pip install git+https://github.com/truera/trulens@piotrm/more_ellipses#subdirectory=trulens_eval
My branch is now merged into main, so ok to try that.