ormsgpack 1.6.0__tar.gz → 1.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ormsgpack might be problematic. Click here for more details.

Files changed (44) hide show
  1. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/CHANGELOG.md +26 -0
  2. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/Cargo.lock +51 -82
  3. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/Cargo.toml +8 -8
  4. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/PKG-INFO +49 -61
  5. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/README.md +46 -57
  6. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/pyproject.toml +22 -4
  7. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/python/ormsgpack/__init__.py +2 -0
  8. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/python/ormsgpack/__init__.pyi +1 -0
  9. ormsgpack-1.8.0/src/deserialize/cache.rs +72 -0
  10. ormsgpack-1.8.0/src/deserialize/deserializer.rs +576 -0
  11. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/lib.rs +60 -69
  12. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/opt.rs +7 -4
  13. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/dataclass.rs +43 -77
  14. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/datetime.rs +4 -4
  15. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/datetimelike.rs +1 -1
  16. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/dict.rs +4 -23
  17. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/ext.rs +1 -4
  18. ormsgpack-1.8.0/src/serialize/numpy.rs +591 -0
  19. ormsgpack-1.8.0/src/serialize/serializer.rs +943 -0
  20. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/typeref.rs +14 -25
  21. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/unicode.rs +11 -55
  22. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/util.rs +3 -36
  23. ormsgpack-1.6.0/src/deserialize/cache.rs +0 -48
  24. ormsgpack-1.6.0/src/deserialize/deserializer.rs +0 -523
  25. ormsgpack-1.6.0/src/serialize/numpy.rs +0 -932
  26. ormsgpack-1.6.0/src/serialize/serializer.rs +0 -318
  27. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/LICENSE-APACHE +0 -0
  28. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/LICENSE-MIT +0 -0
  29. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/build.rs +0 -0
  30. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/python/ormsgpack/py.typed +0 -0
  31. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/deserialize/error.rs +0 -0
  32. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/deserialize/mod.rs +0 -0
  33. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/exc.rs +0 -0
  34. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/ext.rs +0 -0
  35. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/ffi.rs +0 -0
  36. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/bytes.rs +0 -0
  37. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/default.rs +0 -0
  38. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/int.rs +0 -0
  39. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/list.rs +0 -0
  40. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/mod.rs +0 -0
  41. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/str.rs +0 -0
  42. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/tuple.rs +0 -0
  43. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/uuid.rs +0 -0
  44. {ormsgpack-1.6.0 → ormsgpack-1.8.0}/src/serialize/writer.rs +0 -0
@@ -1,5 +1,31 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.8.0 22/02/2025
4
+
5
+ ### Fixed
6
+
7
+ - `packb` now rejects dictionary keys with nested dataclasses or pydantic models
8
+
9
+ ### Changed
10
+
11
+ - Add `packb` option `OPT_PASSTHROUGH_UUID` to enable passthrough of UUID objects [#338](/../../issues/338)
12
+ - Update dependencies
13
+
14
+ ## 1.7.0 29/11/2024
15
+
16
+ ### Fixed
17
+
18
+ - Detect Pydantic 2.10 models [#311](/../../issues/311)
19
+ - Fix serialization of dataclasses without `__slots__` and with a field defined
20
+ with a descriptor object as default value, a field defined with `init=False`
21
+ and a default value, or a cached property
22
+
23
+ ### Changed
24
+
25
+ - Drop support for Python 3.8
26
+ - Support `OPT_SORT_KEYS` also for Pydantic models [#312](/../../issues/312)
27
+ - Improve deserialization performance
28
+
3
29
  ## 1.6.0 18/10/2024
4
30
 
5
31
  ### Fixed
@@ -14,26 +14,11 @@ dependencies = [
14
14
  "zerocopy",
15
15
  ]
16
16
 
17
- [[package]]
18
- name = "any_all_workaround"
19
- version = "0.1.0"
20
- source = "registry+https://github.com/rust-lang/crates.io-index"
21
- checksum = "88fea40735f2cc320a5133ce772d39c571bd6c9b0d4c1a326926eecdd5af2e86"
22
- dependencies = [
23
- "cfg-if",
24
- ]
25
-
26
- [[package]]
27
- name = "associative-cache"
28
- version = "2.0.0"
29
- source = "registry+https://github.com/rust-lang/crates.io-index"
30
- checksum = "b993cd767a2bc7307dd87622311ca22c44329cc7a21366206bfa0896827b2bad"
31
-
32
17
  [[package]]
33
18
  name = "autocfg"
34
- version = "1.3.0"
19
+ version = "1.4.0"
35
20
  source = "registry+https://github.com/rust-lang/crates.io-index"
36
- checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
21
+ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
37
22
 
38
23
  [[package]]
39
24
  name = "bytecount"
@@ -55,28 +40,18 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
55
40
 
56
41
  [[package]]
57
42
  name = "chrono"
58
- version = "0.4.38"
43
+ version = "0.4.39"
59
44
  source = "registry+https://github.com/rust-lang/crates.io-index"
60
- checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
45
+ checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825"
61
46
  dependencies = [
62
47
  "num-traits",
63
48
  ]
64
49
 
65
50
  [[package]]
66
51
  name = "crunchy"
67
- version = "0.2.2"
52
+ version = "0.2.3"
68
53
  source = "registry+https://github.com/rust-lang/crates.io-index"
69
- checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
70
-
71
- [[package]]
72
- name = "encoding_rs"
73
- version = "0.8.34"
74
- source = "registry+https://github.com/rust-lang/crates.io-index"
75
- checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
76
- dependencies = [
77
- "any_all_workaround",
78
- "cfg-if",
79
- ]
54
+ checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929"
80
55
 
81
56
  [[package]]
82
57
  name = "half"
@@ -90,15 +65,15 @@ dependencies = [
90
65
 
91
66
  [[package]]
92
67
  name = "itoa"
93
- version = "1.0.11"
68
+ version = "1.0.14"
94
69
  source = "registry+https://github.com/rust-lang/crates.io-index"
95
- checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
70
+ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
96
71
 
97
72
  [[package]]
98
73
  name = "libc"
99
- version = "0.2.154"
74
+ version = "0.2.169"
100
75
  source = "registry+https://github.com/rust-lang/crates.io-index"
101
- checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
76
+ checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
102
77
 
103
78
  [[package]]
104
79
  name = "memoffset"
@@ -120,28 +95,27 @@ dependencies = [
120
95
 
121
96
  [[package]]
122
97
  name = "once_cell"
123
- version = "1.20.2"
98
+ version = "1.20.3"
124
99
  source = "registry+https://github.com/rust-lang/crates.io-index"
125
- checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
100
+ checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e"
126
101
 
127
102
  [[package]]
128
103
  name = "ormsgpack"
129
- version = "1.6.0"
104
+ version = "1.8.0"
130
105
  dependencies = [
131
106
  "ahash",
132
- "associative-cache",
133
107
  "bytecount",
108
+ "byteorder",
134
109
  "chrono",
135
- "encoding_rs",
136
110
  "half",
137
111
  "itoa",
138
112
  "once_cell",
139
113
  "pyo3",
140
114
  "pyo3-build-config",
141
115
  "rmp",
142
- "rmp-serde",
143
116
  "serde",
144
117
  "serde_bytes",
118
+ "simdutf8",
145
119
  "smallvec",
146
120
  ]
147
121
 
@@ -153,24 +127,24 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
153
127
 
154
128
  [[package]]
155
129
  name = "portable-atomic"
156
- version = "1.6.0"
130
+ version = "1.10.0"
157
131
  source = "registry+https://github.com/rust-lang/crates.io-index"
158
- checksum = "7170ef9988bc169ba16dd36a7fa041e5c4cbeb6a35b76d4c03daded371eae7c0"
132
+ checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
159
133
 
160
134
  [[package]]
161
135
  name = "proc-macro2"
162
- version = "1.0.82"
136
+ version = "1.0.93"
163
137
  source = "registry+https://github.com/rust-lang/crates.io-index"
164
- checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b"
138
+ checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99"
165
139
  dependencies = [
166
140
  "unicode-ident",
167
141
  ]
168
142
 
169
143
  [[package]]
170
144
  name = "pyo3"
171
- version = "0.22.5"
145
+ version = "0.23.4"
172
146
  source = "registry+https://github.com/rust-lang/crates.io-index"
173
- checksum = "3d922163ba1f79c04bc49073ba7b32fd5a8d3b76a87c955921234b8e77333c51"
147
+ checksum = "57fe09249128b3173d092de9523eaa75136bf7ba85e0d69eca241c7939c933cc"
174
148
  dependencies = [
175
149
  "cfg-if",
176
150
  "libc",
@@ -183,9 +157,9 @@ dependencies = [
183
157
 
184
158
  [[package]]
185
159
  name = "pyo3-build-config"
186
- version = "0.22.5"
160
+ version = "0.23.4"
187
161
  source = "registry+https://github.com/rust-lang/crates.io-index"
188
- checksum = "bc38c5feeb496c8321091edf3d63e9a6829eab4b863b4a6a65f26f3e9cc6b179"
162
+ checksum = "1cd3927b5a78757a0d71aa9dff669f903b1eb64b54142a9bd9f757f8fde65fd7"
189
163
  dependencies = [
190
164
  "once_cell",
191
165
  "target-lexicon",
@@ -193,9 +167,9 @@ dependencies = [
193
167
 
194
168
  [[package]]
195
169
  name = "pyo3-ffi"
196
- version = "0.22.5"
170
+ version = "0.23.4"
197
171
  source = "registry+https://github.com/rust-lang/crates.io-index"
198
- checksum = "94845622d88ae274d2729fcefc850e63d7a3ddff5e3ce11bd88486db9f1d357d"
172
+ checksum = "dab6bb2102bd8f991e7749f130a70d05dd557613e39ed2deeee8e9ca0c4d548d"
199
173
  dependencies = [
200
174
  "libc",
201
175
  "pyo3-build-config",
@@ -203,9 +177,9 @@ dependencies = [
203
177
 
204
178
  [[package]]
205
179
  name = "quote"
206
- version = "1.0.36"
180
+ version = "1.0.38"
207
181
  source = "registry+https://github.com/rust-lang/crates.io-index"
208
- checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7"
182
+ checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
209
183
  dependencies = [
210
184
  "proc-macro2",
211
185
  ]
@@ -221,22 +195,11 @@ dependencies = [
221
195
  "paste",
222
196
  ]
223
197
 
224
- [[package]]
225
- name = "rmp-serde"
226
- version = "1.3.0"
227
- source = "registry+https://github.com/rust-lang/crates.io-index"
228
- checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db"
229
- dependencies = [
230
- "byteorder",
231
- "rmp",
232
- "serde",
233
- ]
234
-
235
198
  [[package]]
236
199
  name = "serde"
237
- version = "1.0.210"
200
+ version = "1.0.218"
238
201
  source = "registry+https://github.com/rust-lang/crates.io-index"
239
- checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
202
+ checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"
240
203
  dependencies = [
241
204
  "serde_derive",
242
205
  ]
@@ -252,26 +215,32 @@ dependencies = [
252
215
 
253
216
  [[package]]
254
217
  name = "serde_derive"
255
- version = "1.0.210"
218
+ version = "1.0.218"
256
219
  source = "registry+https://github.com/rust-lang/crates.io-index"
257
- checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
220
+ checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b"
258
221
  dependencies = [
259
222
  "proc-macro2",
260
223
  "quote",
261
224
  "syn",
262
225
  ]
263
226
 
227
+ [[package]]
228
+ name = "simdutf8"
229
+ version = "0.1.5"
230
+ source = "registry+https://github.com/rust-lang/crates.io-index"
231
+ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
232
+
264
233
  [[package]]
265
234
  name = "smallvec"
266
- version = "1.13.2"
235
+ version = "1.14.0"
267
236
  source = "registry+https://github.com/rust-lang/crates.io-index"
268
- checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
237
+ checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
269
238
 
270
239
  [[package]]
271
240
  name = "syn"
272
- version = "2.0.62"
241
+ version = "2.0.98"
273
242
  source = "registry+https://github.com/rust-lang/crates.io-index"
274
- checksum = "9f660c3bfcefb88c538776b6685a0c472e3128b51e74d48793dc2a488196e8eb"
243
+ checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1"
275
244
  dependencies = [
276
245
  "proc-macro2",
277
246
  "quote",
@@ -280,36 +249,36 @@ dependencies = [
280
249
 
281
250
  [[package]]
282
251
  name = "target-lexicon"
283
- version = "0.12.14"
252
+ version = "0.12.16"
284
253
  source = "registry+https://github.com/rust-lang/crates.io-index"
285
- checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
254
+ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
286
255
 
287
256
  [[package]]
288
257
  name = "unicode-ident"
289
- version = "1.0.12"
258
+ version = "1.0.17"
290
259
  source = "registry+https://github.com/rust-lang/crates.io-index"
291
- checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
260
+ checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe"
292
261
 
293
262
  [[package]]
294
263
  name = "version_check"
295
- version = "0.9.4"
264
+ version = "0.9.5"
296
265
  source = "registry+https://github.com/rust-lang/crates.io-index"
297
- checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
266
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
298
267
 
299
268
  [[package]]
300
269
  name = "zerocopy"
301
- version = "0.7.34"
270
+ version = "0.7.35"
302
271
  source = "registry+https://github.com/rust-lang/crates.io-index"
303
- checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087"
272
+ checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
304
273
  dependencies = [
305
274
  "zerocopy-derive",
306
275
  ]
307
276
 
308
277
  [[package]]
309
278
  name = "zerocopy-derive"
310
- version = "0.7.34"
279
+ version = "0.7.35"
311
280
  source = "registry+https://github.com/rust-lang/crates.io-index"
312
- checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b"
281
+ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
313
282
  dependencies = [
314
283
  "proc-macro2",
315
284
  "quote",
@@ -1,12 +1,13 @@
1
1
  [package]
2
2
  name = "ormsgpack"
3
- version = "1.6.0"
3
+ version = "1.8.0"
4
4
  authors = [
5
5
  "Aviram Hassan <aviramyhassan@gmail.com>",
6
6
  "Emanuele Giaquinta <emanuele.giaquinta@gmail.com>",
7
7
  ]
8
8
  description = "Fast, correct Python msgpack library supporting dataclasses, datetimes, and numpy"
9
9
  edition = "2021"
10
+ rust-version = "1.70"
10
11
  license = "Apache-2.0 OR MIT"
11
12
  repository = "https://github.com/aviramha/ormsgpack"
12
13
  homepage = "https://github.com/aviramha/ormsgpack"
@@ -33,27 +34,25 @@ default = ["unstable-simd"]
33
34
  # Use SIMD intrinsics. This requires Rust on the nightly channel.
34
35
  unstable-simd = [
35
36
  "bytecount/generic-simd",
36
- "encoding_rs/simd-accel",
37
37
  ]
38
38
 
39
39
  [dependencies]
40
40
  ahash = { version = "0.8", default-features = false }
41
- associative-cache = { version = "2", default-features = false }
42
41
  bytecount = { version = "^0.6.7", default-features = false, features = ["runtime-dispatch-simd"] }
43
- chrono = { version = "0.4.38", default-features = false }
44
- encoding_rs = { version = "0.8", default-features = false }
42
+ byteorder = { version = "1.5.0", default-features = false, features = ["std"] }
43
+ chrono = { version = "0.4.39", default-features = false }
45
44
  half = { version = "2.4.1", default-features = false }
46
45
  itoa = { version = "1", default-features = false }
47
46
  once_cell = { version = "1", default-features = false, features = ["race"] }
48
- pyo3 = { version = "^0.22.5", default-features = false, features = ["extension-module"] }
47
+ pyo3 = { version = "^0.23.4", default-features = false, features = ["extension-module"] }
49
48
  rmp = { version = "^0.8.14", default-features = false, features = ["std"] }
50
- rmp-serde = { version = "1", default-features = false }
51
49
  serde = { version = "1", default-features = false }
52
50
  serde_bytes = { version = "0.11.15", default-features = false, features = ["std"] }
51
+ simdutf8 = { version = "0.1.5", default-features = false, features = ["std"] }
53
52
  smallvec = { version = "^1.13", default-features = false, features = ["union", "write"] }
54
53
 
55
54
  [build-dependencies]
56
- pyo3-build-config = { version = "^0.22.0" }
55
+ pyo3-build-config = { version = "^0.23.3" }
57
56
 
58
57
  [profile.release]
59
58
  codegen-units = 1
@@ -62,3 +61,4 @@ incremental = false
62
61
  lto = "thin"
63
62
  opt-level = 3
64
63
  panic = "abort"
64
+ strip = "symbols"
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: ormsgpack
3
- Version: 1.6.0
3
+ Version: 1.8.0
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: License :: OSI Approved :: Apache Software License
@@ -9,7 +9,6 @@ Classifier: Operating System :: MacOS
9
9
  Classifier: Operating System :: Microsoft :: Windows
10
10
  Classifier: Operating System :: POSIX :: Linux
11
11
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.8
13
12
  Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
@@ -27,7 +26,7 @@ Home-Page: https://github.com/aviramha/ormsgpack
27
26
  Author: Aviram Hassan <aviramyhassan@gmail.com>, Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
28
27
  Author-email: Aviram Hassan <aviramyhassan@gmail.com>, Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
29
28
  License: Apache-2.0 OR MIT
30
- Requires-Python: >=3.8
29
+ Requires-Python: >=3.9
31
30
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
32
31
  Project-URL: Source Code, https://github.com/aviramha/ormsgpack
33
32
 
@@ -35,28 +34,13 @@ Project-URL: Source Code, https://github.com/aviramha/ormsgpack
35
34
  ![PyPI](https://img.shields.io/pypi/v/ormsgpack)
36
35
  ![PyPI - Downloads](https://img.shields.io/pypi/dm/ormsgpack)
37
36
 
38
- ormsgpack is a fast msgpack library for Python. It is a fork/reboot of [orjson](https://github.com/ijl/orjson)
39
- It serializes faster than [msgpack-python](https://github.com/msgpack/msgpack-python) and deserializes a bit slower (right now).
40
- It supports serialization of:
41
- [dataclass](#dataclass),
42
- [datetime](#datetime),
43
- [numpy](#numpy),
44
- [pydantic](#pydantic) and
45
- [UUID](#uuid) instances natively.
46
-
47
- Its features and drawbacks compared to other Python msgpack libraries:
48
-
49
- * serializes `dataclass` instances natively.
50
- * serializes `datetime`, `date`, and `time` instances to RFC 3339 format,
51
- e.g., "1970-01-01T00:00:00+00:00"
52
- * serializes `numpy.ndarray` instances natively and faster.
53
- * serializes `pydantic.BaseModel` instances natively
54
- * serializes arbitrary types using a `default` hook
55
-
56
- ormsgpack supports CPython 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13.
57
- ormsgpack does not support PyPy. Releases follow semantic
58
- versioning and serializing a new object type without an opt-in flag is
59
- considered a breaking change.
37
+ ormsgpack is a fast msgpack serialization library for Python derived
38
+ from [orjson](https://github.com/ijl/orjson), with native support for
39
+ various Python types.
40
+
41
+ ormsgpack supports CPython 3.9, 3.10, 3.11, 3.12 and 3.13. Releases
42
+ follow semantic versioning and serializing a new object type without
43
+ an opt-in flag is considered a breaking change.
60
44
 
61
45
  ormsgpack is licensed under both the Apache 2.0 and MIT licenses. The
62
46
  repository and issue tracker is
@@ -136,10 +120,9 @@ It natively serializes
136
120
  `None` instances. It supports arbitrary types through `default`. It
137
121
  serializes subclasses of `str`, `int`, `dict`, `list`,
138
122
  `dataclasses.dataclass`, and `enum.Enum`. It does not serialize subclasses
139
- of `tuple` to avoid serializing `namedtuple` objects as arrays. To avoid
140
- serializing subclasses, specify the option `ormsgpack.OPT_PASSTHROUGH_SUBCLASS`.
123
+ of `tuple` to avoid serializing `namedtuple` objects as arrays.
141
124
 
142
- The output is a `bytes` object containing UTF-8.
125
+ The output is a `bytes` object.
143
126
 
144
127
  The global interpreter lock (GIL) is held for the duration of the call.
145
128
 
@@ -221,13 +204,16 @@ value, respectively.
221
204
  b'\xc7\x18\x000.0842389659712649442845'
222
205
  ```
223
206
 
207
+ `default` can also be used to serialize some supported types to a custom
208
+ format by enabling the corresponding passthrough options.
209
+
224
210
  #### option
225
211
 
226
212
  To modify how data is serialized, specify `option`. Each `option` is an integer
227
213
  constant in `ormsgpack`. To specify multiple options, mask them together, e.g.,
228
214
  `option=ormsgpack.OPT_NON_STR_KEYS | ormsgpack.OPT_NAIVE_UTC`.
229
215
 
230
- ##### OPT_NAIVE_UTC
216
+ ##### `OPT_NAIVE_UTC`
231
217
 
232
218
  Serialize `datetime.datetime` objects without a `tzinfo` and `numpy.datetime64`
233
219
  objects as UTC. This has no effect on `datetime.datetime` objects that have
@@ -250,11 +236,13 @@ b'\xb91970-01-01T00:00:00+00:00'
250
236
  '1970-01-01T00:00:00+00:00'
251
237
  ```
252
238
 
253
- ##### OPT_NON_STR_KEYS
239
+ ##### `OPT_NON_STR_KEYS`
254
240
 
255
241
  Serialize `dict` keys of type other than `str`. This allows `dict` keys
256
242
  to be one of `str`, `int`, `float`, `bool`, `None`, `datetime.datetime`,
257
243
  `datetime.date`, `datetime.time`, `enum.Enum`, and `uuid.UUID`.
244
+ `dict` keys of unsupported types are not handled using `default` and
245
+ result in `MsgpackEncodeError` being raised.
258
246
 
259
247
  ```python
260
248
  >>> import ormsgpack, datetime, uuid
@@ -286,7 +274,7 @@ occurrence of a key (in the above, `false`). The first value will be lost.
286
274
 
287
275
  This option is not compatible with `ormsgpack.OPT_SORT_KEYS`.
288
276
 
289
- ##### OPT_OMIT_MICROSECONDS
277
+ ##### `OPT_OMIT_MICROSECONDS`
290
278
 
291
279
  Do not serialize the microsecond component of `datetime.datetime`,
292
280
  `datetime.time` and `numpy.datetime64` instances.
@@ -308,9 +296,10 @@ b'\xb31970-01-01T00:00:00'
308
296
  '1970-01-01T00:00:00'
309
297
  ```
310
298
 
311
- ##### OPT_PASSTHROUGH_BIG_INT
299
+ ##### `OPT_PASSTHROUGH_BIG_INT`
312
300
 
313
- Enables passthrough of big (Python) ints. By setting this option, one can set a `default` function for ints larger than 63 bits, smaller ints are still serialized efficiently.
301
+ Enable passthrough of `int` instances smaller than -9223372036854775807 or
302
+ larger than 18446744073709551615 to `default`.
314
303
 
315
304
  ```python
316
305
  >>> import ormsgpack
@@ -328,10 +317,9 @@ b'\x82\xa4type\xa6bigint\xa5value\xb436893488147419103232'
328
317
  {'type': 'bigint', 'value': '36893488147419103232'}
329
318
  ```
330
319
 
331
- ##### OPT_PASSTHROUGH_DATACLASS
320
+ ##### `OPT_PASSTHROUGH_DATACLASS`
332
321
 
333
- Passthrough `dataclasses.dataclass` instances to `default`. This allows
334
- customizing their output but is much slower.
322
+ Enable passthrough of `dataclasses.dataclass` instances to `default`.
335
323
 
336
324
 
337
325
  ```python
@@ -359,11 +347,10 @@ TypeError: Type is not msgpack serializable: User
359
347
  b'\x82\xa2id\xa33b1\xa4name\xa3asd'
360
348
  ```
361
349
 
362
- ##### OPT_PASSTHROUGH_DATETIME
350
+ ##### `OPT_PASSTHROUGH_DATETIME`
363
351
 
364
- Passthrough `datetime.datetime`, `datetime.date`, and `datetime.time` instances
365
- to `default`. This allows serializing datetimes to a custom format, e.g.,
366
- HTTP dates:
352
+ Enable passthrough of `datetime.datetime`, `datetime.date`, and
353
+ `datetime.time` instances to `default`.
367
354
 
368
355
  ```python
369
356
  >>> import ormsgpack, datetime
@@ -384,11 +371,10 @@ TypeError: Type is not msgpack serializable: datetime.datetime
384
371
  b'\x81\xaacreated_at\xbdThu, 01 Jan 1970 00:00:00 GMT'
385
372
  ```
386
373
 
387
- This does not affect datetimes in `dict` keys if using OPT_NON_STR_KEYS.
374
+ ##### `OPT_PASSTHROUGH_SUBCLASS`
388
375
 
389
- ##### OPT_PASSTHROUGH_SUBCLASS
390
-
391
- Passthrough subclasses of builtin types to `default`.
376
+ Enable passthrough of subclasses of `str`, `int`, `dict` and `list` to
377
+ `default`.
392
378
 
393
379
  ```python
394
380
  >>> import ormsgpack
@@ -408,12 +394,9 @@ TypeError: Type is not msgpack serializable: Secret
408
394
  b'\xa6******'
409
395
  ```
410
396
 
411
- This does not affect serializing subclasses as `dict` keys if using
412
- OPT_NON_STR_KEYS.
413
-
414
- ##### OPT_PASSTHROUGH_TUPLE
397
+ ##### `OPT_PASSTHROUGH_TUPLE`
415
398
 
416
- Passthrough tuples to `default`.
399
+ Enable passthrough of `tuple` instances to `default`.
417
400
 
418
401
  ```python
419
402
  >>> import ormsgpack
@@ -433,18 +416,22 @@ b'\x82\xa4type\xa5tuple\xa5value\x93\xcd#\xe9\xa4test*'
433
416
  {'type': 'tuple', 'value': [9193, 'test', 42]}
434
417
  ```
435
418
 
436
- ##### OPT_SERIALIZE_NUMPY
419
+ ##### `OPT_PASSTHROUGH_UUID`
420
+
421
+ Enable passthrough of `uuid.UUID` instances to `default`.
422
+
423
+ ##### `OPT_SERIALIZE_NUMPY`
437
424
 
438
425
  Serialize `numpy.ndarray` instances. For more, see
439
426
  [numpy](#numpy).
440
427
 
441
- ##### OPT_SERIALIZE_PYDANTIC
428
+ ##### `OPT_SERIALIZE_PYDANTIC`
442
429
  Serialize `pydantic.BaseModel` instances.
443
430
 
444
- ##### OPT_SORT_KEYS
431
+ ##### `OPT_SORT_KEYS`
445
432
 
446
- Serialize `dict` keys in sorted order. The default is to serialize in an
447
- unspecified order.
433
+ Serialize `dict` keys and pydantic model fields in sorted order. The default
434
+ is to serialize in an unspecified order.
448
435
 
449
436
  This can be used to ensure the order is deterministic for hashing or tests.
450
437
  It has a substantial performance penalty and is not recommended in general.
@@ -467,7 +454,7 @@ b'\x83\xa1A\x03\xa1a\x01\xa2\xc3\xa4\x02'
467
454
 
468
455
  `dataclass` also serialize as maps but this has no effect on them.
469
456
 
470
- ##### OPT_UTC_Z
457
+ ##### `OPT_UTC_Z`
471
458
 
472
459
  Serialize a UTC timezone on `datetime.datetime` and `numpy.datetime64` instances
473
460
  as `Z` instead of `+00:00`.
@@ -636,9 +623,6 @@ b'\xaa1900-01-02'
636
623
 
637
624
  Errors with `tzinfo` result in `MsgpackEncodeError` being raised.
638
625
 
639
- To disable serialization of `datetime` objects specify the option
640
- `ormsgpack.OPT_PASSTHROUGH_DATETIME`.
641
-
642
626
  To use "Z" suffix instead of "+00:00" to indicate UTC ("Zulu") time, use the option
643
627
  `ormsgpack.OPT_UTC_Z`.
644
628
 
@@ -797,7 +781,11 @@ b'\xd9$886313e1-3b8a-5372-9b90-0c9aee199e5d'
797
781
  ```
798
782
 
799
783
  ### Pydantic
800
- ormsgpack serializes `pydantic.BaseModel` instances natively.
784
+ ormsgpack serializes `pydantic.BaseModel` instances natively, with
785
+ [duck-typing](https://docs.pydantic.dev/2.10/concepts/serialization/#serializing-with-duck-typing).
786
+ This is equivalent to serializing
787
+ `model.model_dump(serialize_as_any=True)` with Pydantic V2 or
788
+ `model.dict()`with Pydantic V1.
801
789
 
802
790
  #### Performance
803
791
  ![alt text](doc/pydantic.svg "pydantic")
@@ -906,7 +894,7 @@ level above this.
906
894
 
907
895
  ## Packaging
908
896
 
909
- To package ormsgpack requires [Rust](https://www.rust-lang.org/) 1.65
897
+ To package ormsgpack requires [Rust](https://www.rust-lang.org/) 1.70
910
898
  or newer and the [maturin](https://github.com/PyO3/maturin) build
911
899
  tool. The default feature `unstable-simd` enables the usage of SIMD
912
900
  operations and requires nightly Rust. The recommended build command