scrapy / itemadapter

Common interface for data container classes
BSD 3-Clause "New" or "Revised" License
61 stars 13 forks source link

Pydantic 2 released #72

Open sla-te opened 1 year ago

sla-te commented 1 year ago

Since release of Pydantic 2, the implementation is broken due to massive restructs.

dvzrv commented 1 year ago

I have tried to bump pydantic to >= 2 in #76 but am unsure whether my changes are correct. Please review!

We're currently doing rebuilds against pydantic >= 2 on Arch Linux and this project is one of the blockers for the TODO.

a-detiste commented 4 weeks ago

This is my lazy, quick & dirty temporary solution for Debian.

https://salsa.debian.org/python-team/packages/python-itemadapter/-/commit/be2ab7bdb10adfb8235e20bda0333edc075cc037

Forwarded: no

--- a/itemadapter/_imports.py
+++ b/itemadapter/_imports.py
@@ -23,6 +23,6 @@
     attr = None  # type: ignore [assignment]

 try:
-    import pydantic  # pylint: disable=W0611 (unused-import)
+    import pydantic.v1 as pydantic  # pylint: disable=W0611 (unused-import)
 except ImportError:
     pydantic = None  # type: ignore [assignment]
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -102,7 +102,7 @@

 try:
-    from pydantic import BaseModel, Field as PydanticField
+    from pydantic.v1 import BaseModel, Field as PydanticField
 except ImportError:
     PydanticModel = None
     PydanticSpecialCasesModel = None