ormsgpack 1.8.0__tar.gz → 1.9.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.
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/CHANGELOG.md +8 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/Cargo.lock +35 -53
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/Cargo.toml +6 -7
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/PKG-INFO +6 -2
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/README.md +5 -1
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/pyproject.toml +4 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/python/ormsgpack/__init__.py +2 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/python/ormsgpack/__init__.pyi +1 -0
- ormsgpack-1.9.0/python/ormsgpack/_pyinstaller/__init__.py +7 -0
- ormsgpack-1.9.0/python/ormsgpack/_pyinstaller/hook-ormsgpack.py +7 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/deserialize/deserializer.rs +1 -1
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/exc.rs +0 -1
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/ext.rs +5 -5
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/lib.rs +31 -36
- ormsgpack-1.9.0/src/msgpack/array.rs +21 -0
- ormsgpack-1.9.0/src/msgpack/bin.rs +24 -0
- ormsgpack-1.9.0/src/msgpack/bool.rs +13 -0
- ormsgpack-1.9.0/src/msgpack/ext.rs +35 -0
- ormsgpack-1.9.0/src/msgpack/float.rs +22 -0
- ormsgpack-1.9.0/src/msgpack/int.rs +50 -0
- ormsgpack-1.9.0/src/msgpack/map.rs +21 -0
- ormsgpack-1.9.0/src/msgpack/marker.rs +165 -0
- ormsgpack-1.9.0/src/msgpack/mod.rs +23 -0
- ormsgpack-1.9.0/src/msgpack/nil.rs +12 -0
- ormsgpack-1.9.0/src/msgpack/str.rs +26 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/opt.rs +6 -3
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/dataclass.rs +0 -87
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/mod.rs +1 -0
- ormsgpack-1.9.0/src/serialize/pydantic.rs +108 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/serializer.rs +41 -26
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/typeref.rs +50 -112
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/LICENSE-APACHE +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/LICENSE-MIT +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/build.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/python/ormsgpack/py.typed +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/deserialize/cache.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/deserialize/error.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/deserialize/mod.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/ffi.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/bytes.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/datetime.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/datetimelike.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/default.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/dict.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/ext.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/int.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/list.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/numpy.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/str.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/tuple.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/uuid.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/serialize/writer.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/unicode.rs +0 -0
- {ormsgpack-1.8.0 → ormsgpack-1.9.0}/src/util.rs +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.0 23/03/2025
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Add `packb` option `OPT_PASSTHROUGH_ENUM` to enable passthrough of Enum objects by [hinthornw](https://github.com/hinthornw) in [#361](/../../pull/361)
|
|
8
|
+
- Add PyInstaller hook [#354](/../../issues/354)
|
|
9
|
+
- Update dependencies
|
|
10
|
+
|
|
3
11
|
## 1.8.0 22/02/2025
|
|
4
12
|
|
|
5
13
|
### Fixed
|
|
@@ -40,9 +40,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|
|
40
40
|
|
|
41
41
|
[[package]]
|
|
42
42
|
name = "chrono"
|
|
43
|
-
version = "0.4.
|
|
43
|
+
version = "0.4.40"
|
|
44
44
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
45
|
-
checksum = "
|
|
45
|
+
checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c"
|
|
46
46
|
dependencies = [
|
|
47
47
|
"num-traits",
|
|
48
48
|
]
|
|
@@ -55,9 +55,9 @@ checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929"
|
|
|
55
55
|
|
|
56
56
|
[[package]]
|
|
57
57
|
name = "half"
|
|
58
|
-
version = "2.
|
|
58
|
+
version = "2.5.0"
|
|
59
59
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
60
|
-
checksum = "
|
|
60
|
+
checksum = "7db2ff139bba50379da6aa0766b52fdcb62cb5b263009b09ed58ba604e14bbd1"
|
|
61
61
|
dependencies = [
|
|
62
62
|
"cfg-if",
|
|
63
63
|
"crunchy",
|
|
@@ -65,15 +65,15 @@ dependencies = [
|
|
|
65
65
|
|
|
66
66
|
[[package]]
|
|
67
67
|
name = "itoa"
|
|
68
|
-
version = "1.0.
|
|
68
|
+
version = "1.0.15"
|
|
69
69
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
70
|
-
checksum = "
|
|
70
|
+
checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c"
|
|
71
71
|
|
|
72
72
|
[[package]]
|
|
73
73
|
name = "libc"
|
|
74
|
-
version = "0.2.
|
|
74
|
+
version = "0.2.171"
|
|
75
75
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
76
|
-
checksum = "
|
|
76
|
+
checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6"
|
|
77
77
|
|
|
78
78
|
[[package]]
|
|
79
79
|
name = "memoffset"
|
|
@@ -95,13 +95,13 @@ dependencies = [
|
|
|
95
95
|
|
|
96
96
|
[[package]]
|
|
97
97
|
name = "once_cell"
|
|
98
|
-
version = "1.
|
|
98
|
+
version = "1.21.1"
|
|
99
99
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
-
checksum = "
|
|
100
|
+
checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc"
|
|
101
101
|
|
|
102
102
|
[[package]]
|
|
103
103
|
name = "ormsgpack"
|
|
104
|
-
version = "1.
|
|
104
|
+
version = "1.9.0"
|
|
105
105
|
dependencies = [
|
|
106
106
|
"ahash",
|
|
107
107
|
"bytecount",
|
|
@@ -112,39 +112,32 @@ dependencies = [
|
|
|
112
112
|
"once_cell",
|
|
113
113
|
"pyo3",
|
|
114
114
|
"pyo3-build-config",
|
|
115
|
-
"rmp",
|
|
116
115
|
"serde",
|
|
117
116
|
"serde_bytes",
|
|
118
117
|
"simdutf8",
|
|
119
118
|
"smallvec",
|
|
120
119
|
]
|
|
121
120
|
|
|
122
|
-
[[package]]
|
|
123
|
-
name = "paste"
|
|
124
|
-
version = "1.0.15"
|
|
125
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
126
|
-
checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
|
|
127
|
-
|
|
128
121
|
[[package]]
|
|
129
122
|
name = "portable-atomic"
|
|
130
|
-
version = "1.
|
|
123
|
+
version = "1.11.0"
|
|
131
124
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
-
checksum = "
|
|
125
|
+
checksum = "350e9b48cbc6b0e028b0473b114454c6316e57336ee184ceab6e53f72c178b3e"
|
|
133
126
|
|
|
134
127
|
[[package]]
|
|
135
128
|
name = "proc-macro2"
|
|
136
|
-
version = "1.0.
|
|
129
|
+
version = "1.0.94"
|
|
137
130
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
138
|
-
checksum = "
|
|
131
|
+
checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84"
|
|
139
132
|
dependencies = [
|
|
140
133
|
"unicode-ident",
|
|
141
134
|
]
|
|
142
135
|
|
|
143
136
|
[[package]]
|
|
144
137
|
name = "pyo3"
|
|
145
|
-
version = "0.
|
|
138
|
+
version = "0.24.0"
|
|
146
139
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
147
|
-
checksum = "
|
|
140
|
+
checksum = "7f1c6c3591120564d64db2261bec5f910ae454f01def849b9c22835a84695e86"
|
|
148
141
|
dependencies = [
|
|
149
142
|
"cfg-if",
|
|
150
143
|
"libc",
|
|
@@ -157,9 +150,9 @@ dependencies = [
|
|
|
157
150
|
|
|
158
151
|
[[package]]
|
|
159
152
|
name = "pyo3-build-config"
|
|
160
|
-
version = "0.
|
|
153
|
+
version = "0.24.0"
|
|
161
154
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
162
|
-
checksum = "
|
|
155
|
+
checksum = "e9b6c2b34cf71427ea37c7001aefbaeb85886a074795e35f161f5aecc7620a7a"
|
|
163
156
|
dependencies = [
|
|
164
157
|
"once_cell",
|
|
165
158
|
"target-lexicon",
|
|
@@ -167,9 +160,9 @@ dependencies = [
|
|
|
167
160
|
|
|
168
161
|
[[package]]
|
|
169
162
|
name = "pyo3-ffi"
|
|
170
|
-
version = "0.
|
|
163
|
+
version = "0.24.0"
|
|
171
164
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
-
checksum = "
|
|
165
|
+
checksum = "5507651906a46432cdda02cd02dd0319f6064f1374c9147c45b978621d2c3a9c"
|
|
173
166
|
dependencies = [
|
|
174
167
|
"libc",
|
|
175
168
|
"pyo3-build-config",
|
|
@@ -177,47 +170,36 @@ dependencies = [
|
|
|
177
170
|
|
|
178
171
|
[[package]]
|
|
179
172
|
name = "quote"
|
|
180
|
-
version = "1.0.
|
|
173
|
+
version = "1.0.40"
|
|
181
174
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
182
|
-
checksum = "
|
|
175
|
+
checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d"
|
|
183
176
|
dependencies = [
|
|
184
177
|
"proc-macro2",
|
|
185
178
|
]
|
|
186
179
|
|
|
187
|
-
[[package]]
|
|
188
|
-
name = "rmp"
|
|
189
|
-
version = "0.8.14"
|
|
190
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
191
|
-
checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4"
|
|
192
|
-
dependencies = [
|
|
193
|
-
"byteorder",
|
|
194
|
-
"num-traits",
|
|
195
|
-
"paste",
|
|
196
|
-
]
|
|
197
|
-
|
|
198
180
|
[[package]]
|
|
199
181
|
name = "serde"
|
|
200
|
-
version = "1.0.
|
|
182
|
+
version = "1.0.219"
|
|
201
183
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
202
|
-
checksum = "
|
|
184
|
+
checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6"
|
|
203
185
|
dependencies = [
|
|
204
186
|
"serde_derive",
|
|
205
187
|
]
|
|
206
188
|
|
|
207
189
|
[[package]]
|
|
208
190
|
name = "serde_bytes"
|
|
209
|
-
version = "0.11.
|
|
191
|
+
version = "0.11.17"
|
|
210
192
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
211
|
-
checksum = "
|
|
193
|
+
checksum = "8437fd221bde2d4ca316d61b90e337e9e702b3820b87d63caa9ba6c02bd06d96"
|
|
212
194
|
dependencies = [
|
|
213
195
|
"serde",
|
|
214
196
|
]
|
|
215
197
|
|
|
216
198
|
[[package]]
|
|
217
199
|
name = "serde_derive"
|
|
218
|
-
version = "1.0.
|
|
200
|
+
version = "1.0.219"
|
|
219
201
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
220
|
-
checksum = "
|
|
202
|
+
checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00"
|
|
221
203
|
dependencies = [
|
|
222
204
|
"proc-macro2",
|
|
223
205
|
"quote",
|
|
@@ -238,9 +220,9 @@ checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd"
|
|
|
238
220
|
|
|
239
221
|
[[package]]
|
|
240
222
|
name = "syn"
|
|
241
|
-
version = "2.0.
|
|
223
|
+
version = "2.0.100"
|
|
242
224
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
243
|
-
checksum = "
|
|
225
|
+
checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0"
|
|
244
226
|
dependencies = [
|
|
245
227
|
"proc-macro2",
|
|
246
228
|
"quote",
|
|
@@ -249,15 +231,15 @@ dependencies = [
|
|
|
249
231
|
|
|
250
232
|
[[package]]
|
|
251
233
|
name = "target-lexicon"
|
|
252
|
-
version = "0.
|
|
234
|
+
version = "0.13.2"
|
|
253
235
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
254
|
-
checksum = "
|
|
236
|
+
checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a"
|
|
255
237
|
|
|
256
238
|
[[package]]
|
|
257
239
|
name = "unicode-ident"
|
|
258
|
-
version = "1.0.
|
|
240
|
+
version = "1.0.18"
|
|
259
241
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
260
|
-
checksum = "
|
|
242
|
+
checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512"
|
|
261
243
|
|
|
262
244
|
[[package]]
|
|
263
245
|
name = "version_check"
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "ormsgpack"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.9.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.
|
|
10
|
+
rust-version = "1.81"
|
|
11
11
|
license = "Apache-2.0 OR MIT"
|
|
12
12
|
repository = "https://github.com/aviramha/ormsgpack"
|
|
13
13
|
homepage = "https://github.com/aviramha/ormsgpack"
|
|
@@ -40,19 +40,18 @@ unstable-simd = [
|
|
|
40
40
|
ahash = { version = "0.8", default-features = false }
|
|
41
41
|
bytecount = { version = "^0.6.7", default-features = false, features = ["runtime-dispatch-simd"] }
|
|
42
42
|
byteorder = { version = "1.5.0", default-features = false, features = ["std"] }
|
|
43
|
-
chrono = { version = "0.4.
|
|
43
|
+
chrono = { version = "0.4.40", default-features = false }
|
|
44
44
|
half = { version = "2.4.1", default-features = false }
|
|
45
45
|
itoa = { version = "1", default-features = false }
|
|
46
46
|
once_cell = { version = "1", default-features = false, features = ["race"] }
|
|
47
|
-
pyo3 = { version = "^0.
|
|
48
|
-
rmp = { version = "^0.8.14", default-features = false, features = ["std"] }
|
|
47
|
+
pyo3 = { version = "^0.24.0", default-features = false, features = ["extension-module"] }
|
|
49
48
|
serde = { version = "1", default-features = false }
|
|
50
|
-
serde_bytes = { version = "0.11.
|
|
49
|
+
serde_bytes = { version = "0.11.16", default-features = false, features = ["std"] }
|
|
51
50
|
simdutf8 = { version = "0.1.5", default-features = false, features = ["std"] }
|
|
52
51
|
smallvec = { version = "^1.13", default-features = false, features = ["union", "write"] }
|
|
53
52
|
|
|
54
53
|
[build-dependencies]
|
|
55
|
-
pyo3-build-config = { version = "^0.
|
|
54
|
+
pyo3-build-config = { version = "^0.24.0" }
|
|
56
55
|
|
|
57
56
|
[profile.release]
|
|
58
57
|
codegen-units = 1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ormsgpack
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -371,6 +371,10 @@ TypeError: Type is not msgpack serializable: datetime.datetime
|
|
|
371
371
|
b'\x81\xaacreated_at\xbdThu, 01 Jan 1970 00:00:00 GMT'
|
|
372
372
|
```
|
|
373
373
|
|
|
374
|
+
##### `OPT_PASSTHROUGH_ENUM`
|
|
375
|
+
|
|
376
|
+
Enable passthrough of `enum.Enum` instances to `default`.
|
|
377
|
+
|
|
374
378
|
##### `OPT_PASSTHROUGH_SUBCLASS`
|
|
375
379
|
|
|
376
380
|
Enable passthrough of subclasses of `str`, `int`, `dict` and `list` to
|
|
@@ -894,7 +898,7 @@ level above this.
|
|
|
894
898
|
|
|
895
899
|
## Packaging
|
|
896
900
|
|
|
897
|
-
To package ormsgpack requires [Rust](https://www.rust-lang.org/) 1.
|
|
901
|
+
To package ormsgpack requires [Rust](https://www.rust-lang.org/) 1.81
|
|
898
902
|
or newer and the [maturin](https://github.com/PyO3/maturin) build
|
|
899
903
|
tool. The default feature `unstable-simd` enables the usage of SIMD
|
|
900
904
|
operations and requires nightly Rust. The recommended build command
|
|
@@ -339,6 +339,10 @@ TypeError: Type is not msgpack serializable: datetime.datetime
|
|
|
339
339
|
b'\x81\xaacreated_at\xbdThu, 01 Jan 1970 00:00:00 GMT'
|
|
340
340
|
```
|
|
341
341
|
|
|
342
|
+
##### `OPT_PASSTHROUGH_ENUM`
|
|
343
|
+
|
|
344
|
+
Enable passthrough of `enum.Enum` instances to `default`.
|
|
345
|
+
|
|
342
346
|
##### `OPT_PASSTHROUGH_SUBCLASS`
|
|
343
347
|
|
|
344
348
|
Enable passthrough of subclasses of `str`, `int`, `dict` and `list` to
|
|
@@ -862,7 +866,7 @@ level above this.
|
|
|
862
866
|
|
|
863
867
|
## Packaging
|
|
864
868
|
|
|
865
|
-
To package ormsgpack requires [Rust](https://www.rust-lang.org/) 1.
|
|
869
|
+
To package ormsgpack requires [Rust](https://www.rust-lang.org/) 1.81
|
|
866
870
|
or newer and the [maturin](https://github.com/PyO3/maturin) build
|
|
867
871
|
tool. The default feature `unstable-simd` enables the usage of SIMD
|
|
868
872
|
operations and requires nightly Rust. The recommended build command
|
|
@@ -57,6 +57,7 @@ ignore_missing_imports = true
|
|
|
57
57
|
|
|
58
58
|
[tool.ruff]
|
|
59
59
|
line-length = 88
|
|
60
|
+
src = ["python"]
|
|
60
61
|
target-version = "py39"
|
|
61
62
|
|
|
62
63
|
[tool.ruff.lint]
|
|
@@ -74,3 +75,6 @@ ignore = [
|
|
|
74
75
|
|
|
75
76
|
[tool.ruff.lint.isort]
|
|
76
77
|
known-first-party = ["ormsgpack"]
|
|
78
|
+
|
|
79
|
+
[project.entry-points.pyinstaller40]
|
|
80
|
+
hook-dirs = "ormsgpack._pyinstaller:get_hook_dirs"
|
|
@@ -7,6 +7,7 @@ from .ormsgpack import (
|
|
|
7
7
|
OPT_PASSTHROUGH_BIG_INT,
|
|
8
8
|
OPT_PASSTHROUGH_DATACLASS,
|
|
9
9
|
OPT_PASSTHROUGH_DATETIME,
|
|
10
|
+
OPT_PASSTHROUGH_ENUM,
|
|
10
11
|
OPT_PASSTHROUGH_SUBCLASS,
|
|
11
12
|
OPT_PASSTHROUGH_TUPLE,
|
|
12
13
|
OPT_PASSTHROUGH_UUID,
|
|
@@ -35,6 +36,7 @@ __all__ = (
|
|
|
35
36
|
"OPT_PASSTHROUGH_BIG_INT",
|
|
36
37
|
"OPT_PASSTHROUGH_DATACLASS",
|
|
37
38
|
"OPT_PASSTHROUGH_DATETIME",
|
|
39
|
+
"OPT_PASSTHROUGH_ENUM",
|
|
38
40
|
"OPT_PASSTHROUGH_SUBCLASS",
|
|
39
41
|
"OPT_PASSTHROUGH_TUPLE",
|
|
40
42
|
"OPT_PASSTHROUGH_UUID",
|
|
@@ -4,11 +4,11 @@ use crate::deserialize::cache::*;
|
|
|
4
4
|
use crate::deserialize::DeserializeError;
|
|
5
5
|
use crate::exc::*;
|
|
6
6
|
use crate::ffi::*;
|
|
7
|
+
use crate::msgpack::Marker;
|
|
7
8
|
use crate::opt::*;
|
|
8
9
|
use crate::typeref::*;
|
|
9
10
|
use crate::unicode::*;
|
|
10
11
|
use byteorder::{BigEndian, ReadBytesExt};
|
|
11
|
-
use rmp::Marker;
|
|
12
12
|
use simdutf8::basic::{from_utf8, Utf8Error};
|
|
13
13
|
use std::borrow::Cow;
|
|
14
14
|
use std::os::raw::c_char;
|
|
@@ -3,4 +3,3 @@
|
|
|
3
3
|
pub const INVALID_STR: &str = "str is not valid UTF-8: surrogates not allowed";
|
|
4
4
|
pub const RECURSION_LIMIT_REACHED: &str = "Recursion limit reached";
|
|
5
5
|
pub const KEY_MUST_BE_STR: &str = "Dict key must be str";
|
|
6
|
-
pub const PYDANTIC_MUST_HAVE_DICT: &str = "Pydantic's BaseModel must have __dict__ attribute";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use pyo3::ffi::*;
|
|
2
|
-
use std::os::raw::{
|
|
2
|
+
use std::os::raw::{c_int, c_uint, c_void};
|
|
3
3
|
use std::ptr::null_mut;
|
|
4
4
|
|
|
5
5
|
#[repr(C)]
|
|
@@ -18,7 +18,7 @@ unsafe extern "C" fn ext_new(
|
|
|
18
18
|
if Py_SIZE(args) != 2 || !kwds.is_null() {
|
|
19
19
|
PyErr_SetString(
|
|
20
20
|
PyExc_TypeError,
|
|
21
|
-
"Ext.__new__() takes 2 positional arguments
|
|
21
|
+
c"Ext.__new__() takes 2 positional arguments".as_ptr(),
|
|
22
22
|
);
|
|
23
23
|
return null_mut();
|
|
24
24
|
}
|
|
@@ -26,7 +26,7 @@ unsafe extern "C" fn ext_new(
|
|
|
26
26
|
if PyLong_Check(tag) == 0 {
|
|
27
27
|
PyErr_SetString(
|
|
28
28
|
PyExc_TypeError,
|
|
29
|
-
"Ext.__new__() first argument must be int
|
|
29
|
+
c"Ext.__new__() first argument must be int".as_ptr(),
|
|
30
30
|
);
|
|
31
31
|
return null_mut();
|
|
32
32
|
}
|
|
@@ -34,7 +34,7 @@ unsafe extern "C" fn ext_new(
|
|
|
34
34
|
if PyBytes_Check(data) == 0 {
|
|
35
35
|
PyErr_SetString(
|
|
36
36
|
PyExc_TypeError,
|
|
37
|
-
"Ext.__new__() second argument must be bytes
|
|
37
|
+
c"Ext.__new__() second argument must be bytes".as_ptr(),
|
|
38
38
|
);
|
|
39
39
|
return null_mut();
|
|
40
40
|
}
|
|
@@ -69,7 +69,7 @@ pub unsafe fn create_ext_type() -> *mut PyTypeObject {
|
|
|
69
69
|
},
|
|
70
70
|
];
|
|
71
71
|
let mut spec = PyType_Spec {
|
|
72
|
-
name: "ormsgpack.Ext
|
|
72
|
+
name: c"ormsgpack.Ext".as_ptr(),
|
|
73
73
|
basicsize: std::mem::size_of::<PyExt>() as c_int,
|
|
74
74
|
itemsize: 0,
|
|
75
75
|
flags: Py_TPFLAGS_DEFAULT as c_uint,
|
|
@@ -15,32 +15,34 @@ mod deserialize;
|
|
|
15
15
|
mod exc;
|
|
16
16
|
mod ext;
|
|
17
17
|
mod ffi;
|
|
18
|
+
mod msgpack;
|
|
18
19
|
mod opt;
|
|
19
20
|
mod serialize;
|
|
20
21
|
mod typeref;
|
|
21
22
|
mod unicode;
|
|
22
23
|
|
|
23
24
|
use pyo3::ffi::*;
|
|
25
|
+
use std::ffi::CStr;
|
|
24
26
|
use std::os::raw::c_char;
|
|
25
27
|
use std::os::raw::c_int;
|
|
26
28
|
use std::os::raw::c_long;
|
|
27
29
|
use std::os::raw::c_void;
|
|
28
30
|
use std::ptr::NonNull;
|
|
29
31
|
|
|
30
|
-
const PACKB_DOC: &
|
|
31
|
-
"packb(obj, /, default=None, option=None)\n--\n\nSerialize Python objects to msgpack
|
|
32
|
-
const UNPACKB_DOC: &
|
|
33
|
-
"unpackb(obj, /, ext_hook=None, option=None)\n--\n\nDeserialize msgpack to Python objects
|
|
32
|
+
const PACKB_DOC: &CStr =
|
|
33
|
+
c"packb(obj, /, default=None, option=None)\n--\n\nSerialize Python objects to msgpack.";
|
|
34
|
+
const UNPACKB_DOC: &CStr =
|
|
35
|
+
c"unpackb(obj, /, ext_hook=None, option=None)\n--\n\nDeserialize msgpack to Python objects.";
|
|
34
36
|
|
|
35
37
|
macro_rules! module_add_object {
|
|
36
38
|
($mptr: expr, $name: expr, $object:expr) => {
|
|
37
|
-
PyModule_AddObject($mptr, $name.as_ptr()
|
|
39
|
+
PyModule_AddObject($mptr, $name.as_ptr(), $object);
|
|
38
40
|
};
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
macro_rules! module_add_int {
|
|
42
44
|
($mptr:expr, $name:expr, $int:expr) => {
|
|
43
|
-
PyModule_AddIntConstant($mptr, $name.as_ptr()
|
|
45
|
+
PyModule_AddIntConstant($mptr, $name.as_ptr(), $int as c_long);
|
|
44
46
|
};
|
|
45
47
|
}
|
|
46
48
|
|
|
@@ -50,20 +52,20 @@ macro_rules! module_add_int {
|
|
|
50
52
|
pub unsafe extern "C" fn PyInit_ormsgpack() -> *mut PyModuleDef {
|
|
51
53
|
let methods: Box<[PyMethodDef; 3]> = Box::new([
|
|
52
54
|
PyMethodDef {
|
|
53
|
-
ml_name: "packb
|
|
55
|
+
ml_name: c"packb".as_ptr(),
|
|
54
56
|
ml_meth: PyMethodDefPointer {
|
|
55
57
|
PyCFunctionFastWithKeywords: packb,
|
|
56
58
|
},
|
|
57
59
|
ml_flags: METH_FASTCALL | METH_KEYWORDS,
|
|
58
|
-
ml_doc: PACKB_DOC.as_ptr()
|
|
60
|
+
ml_doc: PACKB_DOC.as_ptr(),
|
|
59
61
|
},
|
|
60
62
|
PyMethodDef {
|
|
61
|
-
ml_name: "unpackb
|
|
63
|
+
ml_name: c"unpackb".as_ptr(),
|
|
62
64
|
ml_meth: PyMethodDefPointer {
|
|
63
65
|
PyCFunctionFastWithKeywords: unpackb,
|
|
64
66
|
},
|
|
65
67
|
ml_flags: METH_FASTCALL | METH_KEYWORDS,
|
|
66
|
-
ml_doc: UNPACKB_DOC.as_ptr()
|
|
68
|
+
ml_doc: UNPACKB_DOC.as_ptr(),
|
|
67
69
|
},
|
|
68
70
|
PyMethodDef::zeroed(),
|
|
69
71
|
]);
|
|
@@ -81,7 +83,7 @@ pub unsafe extern "C" fn PyInit_ormsgpack() -> *mut PyModuleDef {
|
|
|
81
83
|
|
|
82
84
|
let init = Box::new(PyModuleDef {
|
|
83
85
|
m_base: PyModuleDef_HEAD_INIT,
|
|
84
|
-
m_name: "ormsgpack
|
|
86
|
+
m_name: c"ormsgpack".as_ptr(),
|
|
85
87
|
m_doc: std::ptr::null(),
|
|
86
88
|
m_size: 0,
|
|
87
89
|
m_methods: Box::into_raw(methods) as *mut PyMethodDef,
|
|
@@ -102,41 +104,34 @@ pub unsafe extern "C" fn ormsgpack_exec(mptr: *mut PyObject) -> c_int {
|
|
|
102
104
|
let version = env!("CARGO_PKG_VERSION");
|
|
103
105
|
module_add_object!(
|
|
104
106
|
mptr,
|
|
105
|
-
"__version__
|
|
107
|
+
c"__version__",
|
|
106
108
|
PyUnicode_FromStringAndSize(version.as_ptr() as *const c_char, version.len() as isize)
|
|
107
109
|
);
|
|
108
110
|
|
|
109
|
-
module_add_int!(mptr, "OPT_NAIVE_UTC
|
|
110
|
-
module_add_int!(mptr, "OPT_NON_STR_KEYS
|
|
111
|
-
module_add_int!(mptr, "OPT_OMIT_MICROSECONDS
|
|
112
|
-
module_add_int!(mptr, "OPT_PASSTHROUGH_BIG_INT
|
|
111
|
+
module_add_int!(mptr, c"OPT_NAIVE_UTC", opt::NAIVE_UTC);
|
|
112
|
+
module_add_int!(mptr, c"OPT_NON_STR_KEYS", opt::NON_STR_KEYS);
|
|
113
|
+
module_add_int!(mptr, c"OPT_OMIT_MICROSECONDS", opt::OMIT_MICROSECONDS);
|
|
114
|
+
module_add_int!(mptr, c"OPT_PASSTHROUGH_BIG_INT", opt::PASSTHROUGH_BIG_INT);
|
|
113
115
|
module_add_int!(
|
|
114
116
|
mptr,
|
|
115
|
-
"OPT_PASSTHROUGH_DATACLASS
|
|
117
|
+
c"OPT_PASSTHROUGH_DATACLASS",
|
|
116
118
|
opt::PASSTHROUGH_DATACLASS
|
|
117
119
|
);
|
|
118
|
-
module_add_int!(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
);
|
|
123
|
-
module_add_int!(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
);
|
|
128
|
-
module_add_int!(mptr, "OPT_SERIALIZE_NUMPY\0", opt::SERIALIZE_NUMPY);
|
|
129
|
-
module_add_int!(mptr, "OPT_SERIALIZE_PYDANTIC\0", opt::SERIALIZE_PYDANTIC);
|
|
130
|
-
module_add_int!(mptr, "OPT_PASSTHROUGH_TUPLE\0", opt::PASSTHROUGH_TUPLE);
|
|
131
|
-
module_add_int!(mptr, "OPT_SORT_KEYS\0", opt::SORT_KEYS);
|
|
132
|
-
module_add_int!(mptr, "OPT_UTC_Z\0", opt::UTC_Z);
|
|
133
|
-
module_add_int!(mptr, "OPT_PASSTHROUGH_UUID\0", opt::PASSTHROUGH_UUID);
|
|
120
|
+
module_add_int!(mptr, c"OPT_PASSTHROUGH_DATETIME", opt::PASSTHROUGH_DATETIME);
|
|
121
|
+
module_add_int!(mptr, c"OPT_PASSTHROUGH_ENUM", opt::PASSTHROUGH_ENUM);
|
|
122
|
+
module_add_int!(mptr, c"OPT_PASSTHROUGH_SUBCLASS", opt::PASSTHROUGH_SUBCLASS);
|
|
123
|
+
module_add_int!(mptr, c"OPT_PASSTHROUGH_TUPLE", opt::PASSTHROUGH_TUPLE);
|
|
124
|
+
module_add_int!(mptr, c"OPT_PASSTHROUGH_UUID", opt::PASSTHROUGH_UUID);
|
|
125
|
+
module_add_int!(mptr, c"OPT_SERIALIZE_NUMPY", opt::SERIALIZE_NUMPY);
|
|
126
|
+
module_add_int!(mptr, c"OPT_SERIALIZE_PYDANTIC", opt::SERIALIZE_PYDANTIC);
|
|
127
|
+
module_add_int!(mptr, c"OPT_SORT_KEYS", opt::SORT_KEYS);
|
|
128
|
+
module_add_int!(mptr, c"OPT_UTC_Z", opt::UTC_Z);
|
|
134
129
|
|
|
135
130
|
typeref::init_typerefs();
|
|
136
131
|
|
|
137
|
-
module_add_object!(mptr, "MsgpackDecodeError
|
|
138
|
-
module_add_object!(mptr, "MsgpackEncodeError
|
|
139
|
-
module_add_object!(mptr, "Ext
|
|
132
|
+
module_add_object!(mptr, c"MsgpackDecodeError", typeref::MsgpackDecodeError);
|
|
133
|
+
module_add_object!(mptr, c"MsgpackEncodeError", typeref::MsgpackEncodeError);
|
|
134
|
+
module_add_object!(mptr, c"Ext", typeref::EXT_TYPE as *mut PyObject);
|
|
140
135
|
|
|
141
136
|
0
|
|
142
137
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
2
|
+
|
|
3
|
+
use crate::msgpack::marker::Marker;
|
|
4
|
+
use byteorder::{BigEndian, WriteBytesExt};
|
|
5
|
+
|
|
6
|
+
pub fn write_array_len<W>(writer: &mut W, len: usize) -> Result<(), std::io::Error>
|
|
7
|
+
where
|
|
8
|
+
W: std::io::Write,
|
|
9
|
+
{
|
|
10
|
+
if len < 16 {
|
|
11
|
+
writer.write_u8(Marker::FixArray(len as u8).into())
|
|
12
|
+
} else if len < 65536 {
|
|
13
|
+
writer.write_u8(Marker::Array16.into())?;
|
|
14
|
+
writer.write_u16::<BigEndian>(len as u16)
|
|
15
|
+
} else if len <= 4294967295 {
|
|
16
|
+
writer.write_u8(Marker::Array32.into())?;
|
|
17
|
+
writer.write_u32::<BigEndian>(len as u32)
|
|
18
|
+
} else {
|
|
19
|
+
Err(std::io::Error::from(std::io::ErrorKind::InvalidInput))
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
2
|
+
|
|
3
|
+
use crate::msgpack::marker::Marker;
|
|
4
|
+
use byteorder::{BigEndian, WriteBytesExt};
|
|
5
|
+
|
|
6
|
+
pub fn write_bin<W>(writer: &mut W, value: &[u8]) -> Result<(), std::io::Error>
|
|
7
|
+
where
|
|
8
|
+
W: std::io::Write,
|
|
9
|
+
{
|
|
10
|
+
let len = value.len();
|
|
11
|
+
if len < 256 {
|
|
12
|
+
writer.write_u8(Marker::Bin8.into())?;
|
|
13
|
+
writer.write_u8(len as u8)?;
|
|
14
|
+
} else if len < 65536 {
|
|
15
|
+
writer.write_u8(Marker::Bin16.into())?;
|
|
16
|
+
writer.write_u16::<BigEndian>(len as u16)?;
|
|
17
|
+
} else if len <= 4294967295 {
|
|
18
|
+
writer.write_u8(Marker::Bin32.into())?;
|
|
19
|
+
writer.write_u32::<BigEndian>(len as u32)?;
|
|
20
|
+
} else {
|
|
21
|
+
return Err(std::io::Error::from(std::io::ErrorKind::InvalidInput));
|
|
22
|
+
}
|
|
23
|
+
writer.write_all(value)
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
2
|
+
|
|
3
|
+
use crate::msgpack::marker::Marker;
|
|
4
|
+
use byteorder::WriteBytesExt;
|
|
5
|
+
|
|
6
|
+
#[inline]
|
|
7
|
+
pub fn write_bool<W>(writer: &mut W, value: bool) -> Result<(), std::io::Error>
|
|
8
|
+
where
|
|
9
|
+
W: std::io::Write,
|
|
10
|
+
{
|
|
11
|
+
let marker = if value { Marker::True } else { Marker::False };
|
|
12
|
+
writer.write_u8(marker.into())
|
|
13
|
+
}
|