kytos-ng / kytos

Kytos SDN Platform. Kytos is designed to be easy to install, use, develop and share Network Apps (NApps).
https://kytos-ng.github.io/
MIT License
2 stars 7 forks source link

Upstream recent release `typing-extensions==4.6.0` is conflicting with `pydantic==1.9.0` #386

Closed viniarck closed 1 year ago

viniarck commented 1 year ago

Yesterday, typing-extensions 4.6.0 was released upstream, this is a development upstream dependency that claims to always be backwards compatible, but it ended up conflicting with pydantic==1.9.0 which does some metaprogramming with type inspection, this only impacts testing, either we need to upgrade python or pin typing-extensions==4.5.0. Pinning typing-extensions==4.5.0 would be the easiest, but let's see if it's already worth also upgrading pydantic.

❯ python3 setup.py test
running test
ImportError while loading conftest '/home/viniarck/repos/kytos/tests/conftest.py'.
tests/conftest.py:7: in <module>
    from kytos.core import Controller
kytos/core/__init__.py:4: in <module>
    from kytos.core.auth import authenticated
kytos/core/auth.py:27: in <module>
    from kytos.core.user import HashSubDoc, UserDoc, UserDocUpdate
kytos/core/user.py:42: in <module>
    class UserDoc(DocumentBaseModel):
pydantic/main.py:204: in pydantic.main.ModelMetaclass.__new__
    ???
pydantic/fields.py:488: in pydantic.fields.ModelField.infer
    ???
pydantic/fields.py:419: in pydantic.fields.ModelField.__init__
    ???
pydantic/fields.py:534: in pydantic.fields.ModelField.prepare
    ???
pydantic/fields.py:638: in pydantic.fields.ModelField._type_analysis
    ???
/usr/lib/python3.9/typing.py:852: in __subclasscheck__
    return issubclass(cls, self.__origin__)
E   TypeError: issubclass() arg 1 must be a class

Thanks for reporting this @italovalcy

viniarck commented 1 year ago

Upgrading pydantic to 1.10.7 didn't work, so pydantic isn't still compatible with this new release, we'll need to pin typing-extensions==4.5.0 for now. Eventually, pydantic core will catch up with new versions of typing-extensions