Skip to content

Issue using typing-extensions > 4.5.0 #162

@ondrej-ivanko

Description

@ondrej-ivanko

Hi,

when I was trying you package with one of the newest versions of FastaAPI which depends on typing-extension >=4.8.0, I ran into a typing error in your code. It applies I believe only to python version less than 3.10. There were changes to Literal which you're using in cases of some of your pydantic Models

I have to use python 3.9 along with Pydantic 1.10.x for dependency purposes. Our company cannot raise the versions of some libraries without proper testing. Is it possible on you side to create new 0.6.x patch version, which uses typing which would work on Python 3.9.

I added links to the issue in Pydantic.
pydantic/pydantic#5824
python/typing_extensions@fb37b2e
pydantic/pydantic#5821 (comment)
pydantic/pydantic#545 (comment)

for better location of error I added logs. It happens already when trying to import the Model Point

rypmaps-gateway-1  |   File "/varistar/./app/schemas/response_schemas.py", line 3, in <module>
rypmaps-gateway-1  |     from geojson_pydantic import Feature, Point
rypmaps-gateway-1  |   File "/usr/local/lib/python3.9/site-packages/geojson_pydantic/__init__.py", line 3, in <module>
rypmaps-gateway-1  |     from .features import Feature, FeatureCollection  # noqa
rypmaps-gateway-1  |   File "/usr/local/lib/python3.9/site-packages/geojson_pydantic/features.py", line 9, in <module>
rypmaps-gateway-1  |     from geojson_pydantic.geometries import Geometry, GeometryCollection
rypmaps-gateway-1  |   File "/usr/local/lib/python3.9/site-packages/geojson_pydantic/geometries.py", line 114, in <module>
rypmaps-gateway-1  |     class Point(_GeometryBase):
rypmaps-gateway-1  |   File "pydantic/main.py", line 204, in pydantic.main.ModelMetaclass.__new__
rypmaps-gateway-1  |   File "pydantic/fields.py", line 488, in pydantic.fields.ModelField.infer
rypmaps-gateway-1  |   File "pydantic/fields.py", line 419, in pydantic.fields.ModelField.__init__
rypmaps-gateway-1  |   File "pydantic/fields.py", line 534, in pydantic.fields.ModelField.prepare
rypmaps-gateway-1  |   File "pydantic/fields.py", line 638, in pydantic.fields.ModelField._type_analysis
rypmaps-gateway-1  |   File "/usr/local/lib/python3.9/typing.py", line 852, in __subclasscheck__
rypmaps-gateway-1  |     return issubclass(cls, self.__origin__)
rypmaps-gateway-1  | TypeError: issubclass() arg 1 must be a class

code:

from geojson_pydantic import FeatureCollection, Point

Thank you for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions