summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-pydantic-core
diff options
context:
space:
mode:
authorFrank de Brabander <debrabander@gmail.com>2024-07-26 15:01:35 +0200
committerKhem Raj <raj.khem@gmail.com>2024-07-26 09:51:39 -0700
commitbee8b9bbc48e5ee9a4b67aed09027e62143eb34c (patch)
tree3db63d1169ca941424a8787f7fca05c42577dbf3 /meta-python/recipes-devtools/python/python3-pydantic-core
parent42a9f8f311a0131595dc9e8a119bffba436c0b16 (diff)
downloadmeta-openembedded-bee8b9bbc48e5ee9a4b67aed09027e62143eb34c.tar.gz
python3-pydantic-core: fix incompatible version
The recipe for pydantic currently is at version 2.7.2. This project specifies in its pyproject.toml that it depends on pydantic-core version 2.18.4. Because an older 2.16.3 version of pydantic-core was used now, a simple bit of code will break. from enum import Enum from pydantic import BaseModel class Color(str, Enum): RED = "RED" BLUE = "BLUE" class Car(BaseModel): color: Color print(Car(color=Color.RED)) This will upgrade the python3-pydantic-core recipe to make it compatible with python3-pydantic, so that the above snippet of code will no longer fail. Two patches are removed, these backports are now included in the upstream code. A new patch is added to set the required rust compiler from 1.76 to 1.75. Version 1.76 is not actually needed. File python3-pydantic-core-crates.inc is regenerated by running 'bitbake -c update_crates python3-pydantic-core'. The recipes RDEPENDS now includes python3-compression. The pydantic schema validator imports 'importlib.metadata' which wants to import 'zipfile'. The buildpaths QA check is skipped. This should be fixed at some point, but it was already failing before this change. Signed-off-by: Frank de Brabander <debrabander@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-pydantic-core')
-rw-r--r--meta-python/recipes-devtools/python/python3-pydantic-core/0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch126
-rw-r--r--meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch29
-rw-r--r--meta-python/recipes-devtools/python/python3-pydantic-core/0001-Set-rust-version-from-1.76-to-1.75-in-Cargo.toml.patch29
3 files changed, 29 insertions, 155 deletions
diff --git a/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch
deleted file mode 100644
index 32777e1d03..0000000000
--- a/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Bumps-pyo3-https-github.com-pyo3-pyo3-from-0.20.2-to.patch
+++ /dev/null
@@ -1,126 +0,0 @@
1From a5690f973384bf8cbf4deb3b83d822b7aaefbdd8 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 27 Feb 2024 11:00:46 -0800
4Subject: [PATCH] Bumps [pyo3](https://github.com/pyo3/pyo3) from 0.20.2 to
5 0.20.3.
6
7Upstream-Status: Pending
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 Cargo.lock | 26 +++++++++++++++++---------
11 Cargo.toml | 2 +-
12 2 files changed, 18 insertions(+), 10 deletions(-)
13
14--- a/Cargo.lock
15+++ b/Cargo.lock
16@@ -322,6 +322,12 @@ source = "registry+https://github.com/ru
17 checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
18
19 [[package]]
20+name = "portable-atomic"
21+version = "1.6.0"
22+source = "registry+https://github.com/rust-lang/crates.io-index"
23+checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
24+
25+[[package]]
26 name = "proc-macro2"
27 version = "1.0.76"
28 source = "registry+https://github.com/rust-lang/crates.io-index"
29@@ -357,9 +363,9 @@ dependencies = [
30
31 [[package]]
32 name = "pyo3"
33-version = "0.20.2"
34+version = "0.20.3"
35 source = "registry+https://github.com/rust-lang/crates.io-index"
36-checksum = "9a89dc7a5850d0e983be1ec2a463a171d20990487c3cfcd68b5363f1ee3d6fe0"
37+checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233"
38 dependencies = [
39 "cfg-if",
40 "indoc",
41@@ -367,6 +373,7 @@ dependencies = [
42 "memoffset",
43 "num-bigint",
44 "parking_lot",
45+ "portable-atomic",
46 "pyo3-build-config",
47 "pyo3-ffi",
48 "pyo3-macros",
49@@ -375,9 +382,9 @@ dependencies = [
50
51 [[package]]
52 name = "pyo3-build-config"
53-version = "0.20.2"
54+version = "0.20.3"
55 source = "registry+https://github.com/rust-lang/crates.io-index"
56-checksum = "07426f0d8fe5a601f26293f300afd1a7b1ed5e78b2a705870c5f30893c5163be"
57+checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7"
58 dependencies = [
59 "once_cell",
60 "python3-dll-a",
61@@ -386,9 +393,9 @@ dependencies = [
62
63 [[package]]
64 name = "pyo3-ffi"
65-version = "0.20.2"
66+version = "0.20.3"
67 source = "registry+https://github.com/rust-lang/crates.io-index"
68-checksum = "dbb7dec17e17766b46bca4f1a4215a85006b4c2ecde122076c562dd058da6cf1"
69+checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa"
70 dependencies = [
71 "libc",
72 "pyo3-build-config",
73@@ -396,9 +403,9 @@ dependencies = [
74
75 [[package]]
76 name = "pyo3-macros"
77-version = "0.20.2"
78+version = "0.20.3"
79 source = "registry+https://github.com/rust-lang/crates.io-index"
80-checksum = "05f738b4e40d50b5711957f142878cfa0f28e054aa0ebdfc3fd137a843f74ed3"
81+checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158"
82 dependencies = [
83 "proc-macro2",
84 "pyo3-macros-backend",
85@@ -408,12 +415,13 @@ dependencies = [
86
87 [[package]]
88 name = "pyo3-macros-backend"
89-version = "0.20.2"
90+version = "0.20.3"
91 source = "registry+https://github.com/rust-lang/crates.io-index"
92-checksum = "0fc910d4851847827daf9d6cdd4a823fbdaab5b8818325c5e97a86da79e8881f"
93+checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185"
94 dependencies = [
95 "heck",
96 "proc-macro2",
97+ "pyo3-build-config",
98 "quote",
99 "syn",
100 ]
101--- a/Cargo.toml
102+++ b/Cargo.toml
103@@ -26,7 +26,7 @@ include = [
104 ]
105
106 [dependencies]
107-pyo3 = { version = "0.20.2", features = ["generate-import-lib", "num-bigint"] }
108+pyo3 = { version = "0.20.3", features = ["generate-import-lib", "num-bigint"] }
109 regex = "1.10.2"
110 strum = { version = "0.25.0", features = ["derive"] }
111 strum_macros = "0.25.3"
112@@ -70,12 +70,12 @@ debug = true
113 strip = false
114
115 [dev-dependencies]
116-pyo3 = { version = "0.20.2", features = ["auto-initialize"] }
117+pyo3 = { version = "0.20.3", features = ["auto-initialize"] }
118
119 [build-dependencies]
120 version_check = "0.9.4"
121 # used where logic has to be version/distribution specific, e.g. pypy
122-pyo3-build-config = { version = "0.20.2" }
123+pyo3-build-config = { version = "0.20.3" }
124
125 [lints.clippy]
126 dbg_macro = "warn"
diff --git a/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch
deleted file mode 100644
index f6aa18e303..0000000000
--- a/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Fix-generate_self_schema-for-Python-3.12-1299.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 0dcca2ed6a83ebbc944ec8cbd2f67ffec8043461 Mon Sep 17 00:00:00 2001
2From: Jelle Zijlstra <jelle.zijlstra@gmail.com>
3Date: Wed, 22 May 2024 07:44:10 -0700
4Subject: [PATCH] Fix generate_self_schema for Python 3.12+ (#1299)
5
6Upstream-Status: Backport [https://github.com/pydantic/pydantic-core/commit/a7620419383a69bd2b28ab953c9a17f6ed35bb9a]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 generate_self_schema.py | 7 ++++++-
10 1 file changed, 6 insertions(+), 1 deletion(-)
11
12diff --git a/generate_self_schema.py b/generate_self_schema.py
13index 8d27247..109fca0 100644
14--- a/generate_self_schema.py
15+++ b/generate_self_schema.py
16@@ -189,7 +189,12 @@ def all_literal_values(type_: type[core_schema.Literal]) -> list[any]:
17
18 def eval_forward_ref(type_: Any) -> Any:
19 try:
20- return type_._evaluate(core_schema.__dict__, None, set())
21+ try:
22+ # Python 3.12+
23+ return type_._evaluate(core_schema.__dict__, None, type_params=set(), recursive_guard=set())
24+ except TypeError:
25+ # Python 3.9+
26+ return type_._evaluate(core_schema.__dict__, None, set())
27 except TypeError:
28 # for Python 3.8
29 return type_._evaluate(core_schema.__dict__, None)
diff --git a/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Set-rust-version-from-1.76-to-1.75-in-Cargo.toml.patch b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Set-rust-version-from-1.76-to-1.75-in-Cargo.toml.patch
new file mode 100644
index 0000000000..c4e6f2f6ab
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-pydantic-core/0001-Set-rust-version-from-1.76-to-1.75-in-Cargo.toml.patch
@@ -0,0 +1,29 @@
1From 6e1852228a2aa38cc76b9a968bba6b603efa5b28 Mon Sep 17 00:00:00 2001
2From: Frank de Brabander <debrabander@gmail.com>
3Date: Thu, 25 Jul 2024 13:50:44 +0200
4Subject: [PATCH] Set rust version from 1.76 to 1.75 in Cargo.toml
5
6Current openembedded-core uses 1.75 and this packages doesn't actually
7require a newer version.
8
9Upstream-Status: Inappropriate
10---
11 Cargo.toml | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/Cargo.toml b/Cargo.toml
15index 8f0ea44..10b277c 100644
16--- a/Cargo.toml
17+++ b/Cargo.toml
18@@ -24,7 +24,7 @@ include = [
19 "!tests/.pytest_cache",
20 "!*.so",
21 ]
22-rust-version = "1.76"
23+rust-version = "1.75"
24
25 [dependencies]
26 pyo3 = { version = "0.21.2", features = ["generate-import-lib", "num-bigint"] }
27--
282.39.2
29