ormsgpack 1.7.0__cp312-cp312-win_amd64.whl → 1.9.0__cp312-cp312-win_amd64.whl

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/__init__.py CHANGED
@@ -7,8 +7,10 @@ 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,
13
+ OPT_PASSTHROUGH_UUID,
12
14
  OPT_SERIALIZE_NUMPY,
13
15
  OPT_SERIALIZE_PYDANTIC,
14
16
  OPT_SORT_KEYS,
@@ -34,8 +36,10 @@ __all__ = (
34
36
  "OPT_PASSTHROUGH_BIG_INT",
35
37
  "OPT_PASSTHROUGH_DATACLASS",
36
38
  "OPT_PASSTHROUGH_DATETIME",
39
+ "OPT_PASSTHROUGH_ENUM",
37
40
  "OPT_PASSTHROUGH_SUBCLASS",
38
41
  "OPT_PASSTHROUGH_TUPLE",
42
+ "OPT_PASSTHROUGH_UUID",
39
43
  "OPT_SERIALIZE_NUMPY",
40
44
  "OPT_SERIALIZE_PYDANTIC",
41
45
  "OPT_SORT_KEYS",
ormsgpack/__init__.pyi CHANGED
@@ -24,8 +24,10 @@ OPT_OMIT_MICROSECONDS: int
24
24
  OPT_PASSTHROUGH_BIG_INT: int
25
25
  OPT_PASSTHROUGH_DATACLASS: int
26
26
  OPT_PASSTHROUGH_DATETIME: int
27
+ OPT_PASSTHROUGH_ENUM: int
27
28
  OPT_PASSTHROUGH_SUBCLASS: int
28
29
  OPT_PASSTHROUGH_TUPLE: int
30
+ OPT_PASSTHROUGH_UUID: int
29
31
  OPT_SERIALIZE_NUMPY: int
30
32
  OPT_SERIALIZE_PYDANTIC: int
31
33
  OPT_NON_STR_KEYS: int
@@ -0,0 +1,7 @@
1
+ # SPDX-License-Identifier: (Apache-2.0 OR MIT)
2
+
3
+ import os
4
+
5
+
6
+ def get_hook_dirs() -> list[str]:
7
+ return [os.path.dirname(__file__)]
@@ -0,0 +1,7 @@
1
+ # SPDX-License-Identifier: (Apache-2.0 OR MIT)
2
+
3
+ hiddenimports = [
4
+ "dataclasses",
5
+ "enum",
6
+ "uuid",
7
+ ]
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ormsgpack
3
- Version: 1.7.0
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
@@ -120,8 +120,7 @@ It natively serializes
120
120
  `None` instances. It supports arbitrary types through `default`. It
121
121
  serializes subclasses of `str`, `int`, `dict`, `list`,
122
122
  `dataclasses.dataclass`, and `enum.Enum`. It does not serialize subclasses
123
- of `tuple` to avoid serializing `namedtuple` objects as arrays. To avoid
124
- serializing subclasses, specify the option `ormsgpack.OPT_PASSTHROUGH_SUBCLASS`.
123
+ of `tuple` to avoid serializing `namedtuple` objects as arrays.
125
124
 
126
125
  The output is a `bytes` object.
127
126
 
@@ -205,13 +204,16 @@ value, respectively.
205
204
  b'\xc7\x18\x000.0842389659712649442845'
206
205
  ```
207
206
 
207
+ `default` can also be used to serialize some supported types to a custom
208
+ format by enabling the corresponding passthrough options.
209
+
208
210
  #### option
209
211
 
210
212
  To modify how data is serialized, specify `option`. Each `option` is an integer
211
213
  constant in `ormsgpack`. To specify multiple options, mask them together, e.g.,
212
214
  `option=ormsgpack.OPT_NON_STR_KEYS | ormsgpack.OPT_NAIVE_UTC`.
213
215
 
214
- ##### OPT_NAIVE_UTC
216
+ ##### `OPT_NAIVE_UTC`
215
217
 
216
218
  Serialize `datetime.datetime` objects without a `tzinfo` and `numpy.datetime64`
217
219
  objects as UTC. This has no effect on `datetime.datetime` objects that have
@@ -234,11 +236,13 @@ b'\xb91970-01-01T00:00:00+00:00'
234
236
  '1970-01-01T00:00:00+00:00'
235
237
  ```
236
238
 
237
- ##### OPT_NON_STR_KEYS
239
+ ##### `OPT_NON_STR_KEYS`
238
240
 
239
241
  Serialize `dict` keys of type other than `str`. This allows `dict` keys
240
242
  to be one of `str`, `int`, `float`, `bool`, `None`, `datetime.datetime`,
241
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.
242
246
 
243
247
  ```python
244
248
  >>> import ormsgpack, datetime, uuid
@@ -270,7 +274,7 @@ occurrence of a key (in the above, `false`). The first value will be lost.
270
274
 
271
275
  This option is not compatible with `ormsgpack.OPT_SORT_KEYS`.
272
276
 
273
- ##### OPT_OMIT_MICROSECONDS
277
+ ##### `OPT_OMIT_MICROSECONDS`
274
278
 
275
279
  Do not serialize the microsecond component of `datetime.datetime`,
276
280
  `datetime.time` and `numpy.datetime64` instances.
@@ -292,9 +296,10 @@ b'\xb31970-01-01T00:00:00'
292
296
  '1970-01-01T00:00:00'
293
297
  ```
294
298
 
295
- ##### OPT_PASSTHROUGH_BIG_INT
299
+ ##### `OPT_PASSTHROUGH_BIG_INT`
296
300
 
297
- 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`.
298
303
 
299
304
  ```python
300
305
  >>> import ormsgpack
@@ -312,10 +317,9 @@ b'\x82\xa4type\xa6bigint\xa5value\xb436893488147419103232'
312
317
  {'type': 'bigint', 'value': '36893488147419103232'}
313
318
  ```
314
319
 
315
- ##### OPT_PASSTHROUGH_DATACLASS
320
+ ##### `OPT_PASSTHROUGH_DATACLASS`
316
321
 
317
- Passthrough `dataclasses.dataclass` instances to `default`. This allows
318
- customizing their output but is much slower.
322
+ Enable passthrough of `dataclasses.dataclass` instances to `default`.
319
323
 
320
324
 
321
325
  ```python
@@ -343,11 +347,10 @@ TypeError: Type is not msgpack serializable: User
343
347
  b'\x82\xa2id\xa33b1\xa4name\xa3asd'
344
348
  ```
345
349
 
346
- ##### OPT_PASSTHROUGH_DATETIME
350
+ ##### `OPT_PASSTHROUGH_DATETIME`
347
351
 
348
- Passthrough `datetime.datetime`, `datetime.date`, and `datetime.time` instances
349
- to `default`. This allows serializing datetimes to a custom format, e.g.,
350
- HTTP dates:
352
+ Enable passthrough of `datetime.datetime`, `datetime.date`, and
353
+ `datetime.time` instances to `default`.
351
354
 
352
355
  ```python
353
356
  >>> import ormsgpack, datetime
@@ -368,11 +371,14 @@ TypeError: Type is not msgpack serializable: datetime.datetime
368
371
  b'\x81\xaacreated_at\xbdThu, 01 Jan 1970 00:00:00 GMT'
369
372
  ```
370
373
 
371
- This does not affect datetimes in `dict` keys if using OPT_NON_STR_KEYS.
374
+ ##### `OPT_PASSTHROUGH_ENUM`
375
+
376
+ Enable passthrough of `enum.Enum` instances to `default`.
372
377
 
373
- ##### OPT_PASSTHROUGH_SUBCLASS
378
+ ##### `OPT_PASSTHROUGH_SUBCLASS`
374
379
 
375
- Passthrough subclasses of builtin types to `default`.
380
+ Enable passthrough of subclasses of `str`, `int`, `dict` and `list` to
381
+ `default`.
376
382
 
377
383
  ```python
378
384
  >>> import ormsgpack
@@ -392,12 +398,9 @@ TypeError: Type is not msgpack serializable: Secret
392
398
  b'\xa6******'
393
399
  ```
394
400
 
395
- This does not affect serializing subclasses as `dict` keys if using
396
- OPT_NON_STR_KEYS.
397
-
398
- ##### OPT_PASSTHROUGH_TUPLE
401
+ ##### `OPT_PASSTHROUGH_TUPLE`
399
402
 
400
- Passthrough tuples to `default`.
403
+ Enable passthrough of `tuple` instances to `default`.
401
404
 
402
405
  ```python
403
406
  >>> import ormsgpack
@@ -417,15 +420,19 @@ b'\x82\xa4type\xa5tuple\xa5value\x93\xcd#\xe9\xa4test*'
417
420
  {'type': 'tuple', 'value': [9193, 'test', 42]}
418
421
  ```
419
422
 
420
- ##### OPT_SERIALIZE_NUMPY
423
+ ##### `OPT_PASSTHROUGH_UUID`
424
+
425
+ Enable passthrough of `uuid.UUID` instances to `default`.
426
+
427
+ ##### `OPT_SERIALIZE_NUMPY`
421
428
 
422
429
  Serialize `numpy.ndarray` instances. For more, see
423
430
  [numpy](#numpy).
424
431
 
425
- ##### OPT_SERIALIZE_PYDANTIC
432
+ ##### `OPT_SERIALIZE_PYDANTIC`
426
433
  Serialize `pydantic.BaseModel` instances.
427
434
 
428
- ##### OPT_SORT_KEYS
435
+ ##### `OPT_SORT_KEYS`
429
436
 
430
437
  Serialize `dict` keys and pydantic model fields in sorted order. The default
431
438
  is to serialize in an unspecified order.
@@ -451,7 +458,7 @@ b'\x83\xa1A\x03\xa1a\x01\xa2\xc3\xa4\x02'
451
458
 
452
459
  `dataclass` also serialize as maps but this has no effect on them.
453
460
 
454
- ##### OPT_UTC_Z
461
+ ##### `OPT_UTC_Z`
455
462
 
456
463
  Serialize a UTC timezone on `datetime.datetime` and `numpy.datetime64` instances
457
464
  as `Z` instead of `+00:00`.
@@ -620,9 +627,6 @@ b'\xaa1900-01-02'
620
627
 
621
628
  Errors with `tzinfo` result in `MsgpackEncodeError` being raised.
622
629
 
623
- To disable serialization of `datetime` objects specify the option
624
- `ormsgpack.OPT_PASSTHROUGH_DATETIME`.
625
-
626
630
  To use "Z" suffix instead of "+00:00" to indicate UTC ("Zulu") time, use the option
627
631
  `ormsgpack.OPT_UTC_Z`.
628
632
 
@@ -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.70
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
@@ -0,0 +1,12 @@
1
+ ormsgpack-1.9.0.dist-info/METADATA,sha256=p0kPYJGh_OvdtbRB5mfpqBuwDTytdX9HW3JnF-cwS5w,44361
2
+ ormsgpack-1.9.0.dist-info/WHEEL,sha256=jABKVkLC9kJr8mi_er5jOqpiQUjARSLXDUIIxDqsS50,96
3
+ ormsgpack-1.9.0.dist-info/entry_points.txt,sha256=b4bGmxqo1PPqO42Cjz2A2X4Gy4h1PCoOygCzeS-m22I,63
4
+ ormsgpack-1.9.0.dist-info/licenses/LICENSE-APACHE,sha256=fP1zjFPWHHnwfjSPYiv3cHyQhCNwVNN_vgd4inX1iBw,11048
5
+ ormsgpack-1.9.0.dist-info/licenses/LICENSE-MIT,sha256=NlFq79yExdWh50hUJZE6ItvaaesZMMXoTWrklytRlLk,1046
6
+ ormsgpack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ ormsgpack/_pyinstaller/hook-ormsgpack.py,sha256=Bj3rdqNTDG_uR-qYnGA0GHiKshhyBrdY_xlyc0hTD_Q,118
8
+ ormsgpack/_pyinstaller/__init__.py,sha256=PiSpvMUWta2R2gVSfAut2h3Vtw9saEyF92GjC4h293E,140
9
+ ormsgpack/__init__.py,sha256=71z0yVisd9vXd53nMWrDPz3zT5KM535N7XSGZeDXDQg,1081
10
+ ormsgpack/__init__.pyi,sha256=m367J44MWhEgP0-R5l2clxqQsw7BJdtbz8oSdyVe4fQ,905
11
+ ormsgpack/ormsgpack.cp312-win_amd64.pyd,sha256=3P3K6WyiAfx5YxtCclYGQgONh--0GzkM8Mgtxn52C-I,215040
12
+ ormsgpack-1.9.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.7.8)
2
+ Generator: maturin (1.8.3)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp312-cp312-win_amd64
@@ -0,0 +1,2 @@
1
+ [pyinstaller40]
2
+ hook-dirs=ormsgpack._pyinstaller:get_hook_dirs
@@ -1,9 +0,0 @@
1
- ormsgpack-1.7.0.dist-info/METADATA,sha256=UIb3GG9Z4O4O3xUEFYv8TL3eeeJoLVBSrUM9dGOTe-I,44379
2
- ormsgpack-1.7.0.dist-info/WHEEL,sha256=_-KsFRIAGXkqA80mFpUSYVZVhiQ0-B7C3YKRIicO45o,96
3
- ormsgpack-1.7.0.dist-info/licenses/LICENSE-APACHE,sha256=fP1zjFPWHHnwfjSPYiv3cHyQhCNwVNN_vgd4inX1iBw,11048
4
- ormsgpack-1.7.0.dist-info/licenses/LICENSE-MIT,sha256=NlFq79yExdWh50hUJZE6ItvaaesZMMXoTWrklytRlLk,1046
5
- ormsgpack/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- ormsgpack/__init__.py,sha256=cO7CRlLMoqVgapEc5lz2nE0SNNuvi659IAbl0fYU4_Q,969
7
- ormsgpack/__init__.pyi,sha256=ifO6bsEVSuexKoxAF37hhZperoUVIyT6it2NLq79fa8,851
8
- ormsgpack/ormsgpack.cp312-win_amd64.pyd,sha256=2gt6TUA7OgF5XgXdgam-ctd-0UTpsJEYZxaAxjwPwzk,214528
9
- ormsgpack-1.7.0.dist-info/RECORD,,