dgilland / pydash

The kitchen sink of Python utility libraries for doing "stuff" in a functional way. Based on the Lo-Dash Javascript library.
http://pydash.readthedocs.io
MIT License
1.28k stars 89 forks source link

Incompatible with typing-extensions 4.6 #197

Closed lephuongbg closed 1 year ago

lephuongbg commented 1 year ago

Got this error when upgrading typing-extensions to 4.6. pydash works fine with typing-extensions 4.5.

utils/__init__.py:20: in <module>
    from pydash import last
.venv/lib/python3.10/site-packages/pydash/__init__.py:170: in <module>
    from .objects import (
.venv/lib/python3.10/site-packages/pydash/objects.py:17: in <module>
    from .utilities import PathToken, to_path, to_path_tokens
.venv/lib/python3.10/site-packages/pydash/utilities.py:577: in <module>
    class MemoizedFunc(Protocol[P, T, T2]):
../lang/lib/python3.10/typing.py:312: in inner
    return func(*args, **kwds)
.venv/lib/python3.10/site-packages/typing_extensions.py:672: in __class_getitem__
    raise TypeError(
E   TypeError: Parameters to Protocol[...] must all be type variables. Parameter 1 is ~P
Tenzer commented 1 year ago

I did some bisecting of the changes between typing-extensions 4.5.0 and 4.6.0 and found the changes in https://github.com/python/typing_extensions/pull/137 to be the culprit.

I have posted on that PR for any pointers on how to fix this incompatibility, as I can't immediately work it out.

Tenzer commented 1 year ago

typing-extensions 4.6.1 has been released now which fixes this.

jenstroeger commented 1 year ago

With the typing-extensions package’s fix, shouldn’t pydash also change its own requirements to avoid importing the culprit version — this requirement

install_requires =
    typing-extensions>=3.10

seems rather loose to me.