You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All preconf converters now have `loads` and `dumps` methods, which combine un/structuring and the de/serialization logic from their underlying libraries.
Bytes are serialized as base 85 strings. Counters are serialized as dictionaries. Sets are serialized as lists, and deserialized back into sets. `datetime` s are serialized as ISO 8601 strings.
60
+
Bytes are serialized as base 85 strings. Counters are serialized as dictionaries. Sets are serialized as lists, and deserialized back into sets. `datetime` s and `date` s are serialized as ISO 8601 strings.
61
61
62
62
## _ujson_
63
63
64
64
Found at {mod}`cattrs.preconf.ujson`.
65
65
66
-
Bytes are serialized as base 85 strings. Sets are serialized as lists, and deserialized back into sets. `datetime` s are serialized as ISO 8601 strings.
66
+
Bytes are serialized as base 85 strings. Sets are serialized as lists, and deserialized back into sets. `datetime` s and `date` s are serialized as ISO 8601 strings.
67
67
68
68
`ujson` doesn't support integers less than -9223372036854775808, and greater than 9223372036854775807, nor does it support `float('inf')`.
69
69
70
70
## _orjson_
71
71
72
72
Found at {mod}`cattrs.preconf.orjson`.
73
73
74
-
Bytes are serialized as base 85 strings. Sets are serialized as lists, and deserialized back into sets. `datetime` s are serialized as ISO 8601 strings.
74
+
Bytes are serialized as base 85 strings. Sets are serialized as lists, and deserialized back into sets. `datetime` s and `date` s are serialized as ISO 8601 strings.
75
75
76
76
_orjson_ doesn't support integers less than -9223372036854775808, and greater than 9223372036854775807.
77
77
_orjson_ only supports mappings with string keys so mappings will have their keys stringified before serialization, and destringified during deserialization.
@@ -80,7 +80,7 @@ _orjson_ only supports mappings with string keys so mappings will have their key
80
80
81
81
Found at {mod}`cattrs.preconf.msgpack`.
82
82
83
-
Sets are serialized as lists, and deserialized back into sets. `datetime` s are serialized as UNIX timestamp float values.
83
+
Sets are serialized as lists, and deserialized back into sets. `datetime` s are serialized as UNIX timestamp float values.`date` s are serialized as midnight-aligned UNIX timestamp float values.
84
84
85
85
_msgpack_ doesn't support integers less than -9223372036854775808, and greater than 18446744073709551615.
86
86
@@ -103,6 +103,8 @@ Tuples are serialized as lists.
103
103
Use keyword argument `datetime_as_timestamp=True` to encode as UNIX timestamp integer/float (CBOR Tag 1)
104
104
**note:** this replaces timezone information as UTC.
105
105
106
+
`date` s are serialized as ISO 8601 strings.
107
+
106
108
Use keyword argument `canonical=True` for efficient encoding to the smallest binary output.
107
109
108
110
Floats can be forced to smaller output by casting to lower-precision formats by casting to `numpy` floats (and back to Python floats).
@@ -118,19 +120,20 @@ _bson_ doesn't support integers less than -9223372036854775808 or greater than 9
118
120
_bson_ does not support null bytes in mapping keys.
119
121
_bson_ only supports mappings with string keys so mappings will have their keys stringified before serialization, and destringified during deserialization.
120
122
The _bson_ datetime representation doesn't support microsecond accuracy.
123
+
`date` s are serialized as ISO 8601 strings.
121
124
122
125
When encoding and decoding, the library needs to be passed `codec_options=bson.CodecOptions(tz_aware=True)` to get the full range of compatibility.
123
126
124
127
## _pyyaml_
125
128
126
129
Found at {mod}`cattrs.preconf.pyyaml`.
127
130
128
-
Frozensets are serialized as lists, and deserialized back into frozensets.
131
+
Frozensets are serialized as lists, and deserialized back into frozensets.`date` s are serialized as ISO 8601 strings.
129
132
130
133
## _tomlkit_
131
134
132
135
Found at {mod}`cattrs.preconf.tomlkit`.
133
136
134
137
Bytes are serialized as base 85 strings. Sets are serialized as lists, and deserialized back into sets.
135
138
Tuples are serialized as lists, and deserialized back into tuples.
136
-
_tomlkit_ only supports mappings with string keys so mappings will have their keys stringified before serialization, and destringified during deserialization.
139
+
_tomlkit_ only supports mappings with string keys so mappings will have their keys stringified before serialization, and destringified during deserialization.`date` s are serialized as ISO 8601 strings.
0 commit comments