Skip to content

Commit f36f17f

Browse files
authored
Milestone to v1 (#212)
* apply `@dataclass` decorator * add `pprint` for `__str__()` * Lotta Changes to `Load`, it's Supa Fast !!! * Fixing a bug * move to `v1` * ive got deser for defaultdict, enum, uuid, decimal, and path working! * minor changes * add support for time, date, datetime, and timedelta * add support for namedtuple, NamedTuple * add support for TypedDict * add support for ReadOnly, Literal, Annotated, LiteralString * fix for nested dataclasses * minor refactor and changes * feat: deserialize `Union` types * feat: add `v1` and `v1_unsafe_parse_dataclass_in_union` * Update signature of `LoadMeta`, `DumpMeta`, and `EnvMeta` to accept keyword arguments `**kwargs` * Add loader_selection.py to allow selection of loader (`v1` or not) * feat: add `v1` and `v1_unsafe_parse_dataclass_in_union` * Update signature of `LoadMeta`, `DumpMeta`, and `EnvMeta` to accept keyword arguments `**kwargs` * Add loader_selection.py to allow selection of loader (`v1` or not) * fix tests and disable auto `@dataclass` application * i think that fix it * i think that fix it * Moar Updates * Add support for `Sequence`, `Collection`, and `MutableSequence` * Add support for container class with `Meta` config (#163) * Fix for `NoneType` * minor changes and tests need be added * optimize missing fields * add support for key casing * add support for aliases * partially add `raise_on_unknown_key` support * fully add `raise_on_unknown_key` support * add support for `CatchAll` * fully support `CatchAll` * add more test cases for coverage * add benchmarks for catch all * update to use `pytest-benchmark` * publish plot/graph for `CatchAll` benchmark tests * also refactor into `requirements-bench.txt` * checkin changes so far * fix logic so its working * completely fix `AliasPath` * fix tests on CI * fix tests on CI * fix tests on CI * try fix tests on CI * try fix tests on CI * thats not the issue, ima have to try debug it locally * Im stupid, we need to use `is_subclass_safe` after all :o * I tire of this * Update badges and docs * Update docs to mention v1` opt-in * update description * one last change, think its good to go! * add section on perf in v1 * clean up comments * Update HISTORY.rst * Update HISTORY.rst and add Dark Mode for Docs! * minor working udpates * working now * minor updates * minor updates * minor updates * minor updates * minor updates * minor updates * minor updates * minor updates * minor updates * minor updates * minor updates * minor updates * Fix tests and `get_resolved_annotations` for property_wizard.py * Fix tests * update docs * minor fixes * minor fixes * minor fixes * minor fixes * minor fixes * minor fixes
1 parent 92fd064 commit f36f17f

37 files changed

+3215
-388
lines changed

HISTORY.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,33 @@
22
History
33
=======
44

5+
6+
0.36.0 (2025-12-14)
7+
------------------
8+
9+
**Features and Improvements**
10+
11+
* Introduce ``DataclassWizard`` as the preferred base class for the v1 API.
12+
This class auto-applies the ``@dataclass`` decorator to subclasses, reducing
13+
boilerplate and clarifying the recommended usage going forward.
14+
* Add explicit v1 dump support via a new ``v1/dumpers.py`` implementation.
15+
This refactor improves separation of concerns and results in better
16+
serialization performance when v1 is enabled.
17+
* Update default usage examples and documentation to reflect the new
18+
``DataclassWizard`` API and explicit ``load_case`` / ``dump_case`` configuration.
19+
* Fix annotation resolution for older Python versions by routing
20+
through ``get_resolved_annotations()``.
21+
22+
**API Changes**
23+
24+
* Rename ``v1_key_case`` to ``v1_case`` for clarity and consistency with related
25+
v1 configuration options.
26+
27+
**Internal Changes**
28+
29+
* Refactor v1 load/dump selection logic to route through the new v1 loader and
30+
dumper pipeline when enabled.
31+
532
0.35.4 (2025-12-12)
633
-------------------
734

README.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ for complex and *nested dataclass* models!
3232
**Behold, the power of the Dataclass Wizard**::
3333

3434
>>> from __future__ import annotations
35-
>>> from dataclasses import dataclass, field
36-
>>> from dataclass_wizard import JSONWizard
35+
>>> from dataclasses import field
36+
>>> from dataclass_wizard import DataclassWizard
3737
...
38-
>>> @dataclass
39-
... class MyClass(JSONWizard):
38+
>>> # DataclassWizard auto-applies @dataclass to subclasses
39+
... class MyClass(DataclassWizard, load_case='AUTO', dump_case='CAMEL'):
4040
... my_str: str | None
4141
... is_active_tuple: tuple[bool, ...]
4242
... list_of_int: list[int] = field(default_factory=list)
@@ -1516,7 +1516,7 @@ What's New in v1.0
15161516
print(MyModel(my_field="value").to_dict())
15171517
# Output: {'my_field': 'value'}
15181518
1519-
- **Default __str__() Behavior Change**
1519+
- **Default __str__() Behavior Change**
15201520

15211521
Starting with **v1.0.0**, we no longer pretty-print the serialized JSON value with keys in ``camelCase``.
15221522
Instead, we now use the ``pprint`` module to handle serialization formatting.

benchmarks/complex.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -219,14 +219,14 @@ def test_load(request, data, data_2, data_dacite, n):
219219
"""
220220
[ RESULTS ON MAC OS X ]
221221
222-
benchmarks.complex.complex - [INFO] dataclass-wizard 0.325364
223-
benchmarks.complex.complex - [INFO] dataclass-factory 0.773195
224-
benchmarks.complex.complex - [INFO] dataclasses-json 28.435088
225-
benchmarks.complex.complex - [INFO] dacite 6.287875
226-
benchmarks.complex.complex - [INFO] mashumaro 0.344701
227-
benchmarks.complex.complex - [INFO] pydantic 0.547749
228-
benchmarks.complex.complex - [INFO] jsons 29.978993
229-
benchmarks.complex.complex - [INFO] jsons (strict) 34.052532
222+
benchmarks.complex.complex - [INFO] dataclass-wizard 0.317641
223+
benchmarks.complex.complex - [INFO] dataclass-factory 0.751124
224+
benchmarks.complex.complex - [INFO] dacite 6.350958
225+
benchmarks.complex.complex - [INFO] mashumaro 0.343612
226+
benchmarks.complex.complex - [INFO] pydantic 0.538801
227+
benchmarks.complex.complex - [INFO] dataclasses-json 28.214992
228+
benchmarks.complex.complex - [INFO] jsons 31.735730
229+
benchmarks.complex.complex - [INFO] jsons (strict) 34.855084
230230
"""
231231
g = globals().copy()
232232
g.update(locals())
@@ -276,14 +276,14 @@ def test_dump(request, data, data_2, data_dacite, n):
276276
"""
277277
[ RESULTS ON MAC OS X ]
278278
279-
benchmarks.complex.complex - [INFO] dataclass-wizard 1.606120
280-
benchmarks.complex.complex - [INFO] asdict (dataclasses) 2.006917
281-
benchmarks.complex.complex - [INFO] dataclass-factory 0.979412
282-
benchmarks.complex.complex - [INFO] dataclasses-json 13.740522
283-
benchmarks.complex.complex - [INFO] mashumaro 0.289991
284-
benchmarks.complex.complex - [INFO] pydantic 0.384267
285-
benchmarks.complex.complex - [INFO] jsons 41.673240
286-
benchmarks.complex.complex - [INFO] jsons (strict) 45.934885
279+
benchmarks.complex.complex - [INFO] dataclass-wizard 0.405688
280+
benchmarks.complex.complex - [INFO] asdict (dataclasses) 1.727631
281+
benchmarks.complex.complex - [INFO] dataclass-factory 0.831178
282+
benchmarks.complex.complex - [INFO] dataclasses-json 11.072727
283+
benchmarks.complex.complex - [INFO] mashumaro 0.248298
284+
benchmarks.complex.complex - [INFO] pydantic 0.316203
285+
benchmarks.complex.complex - [INFO] jsons 37.361450
286+
benchmarks.complex.complex - [INFO] jsons (strict) 31.578708
287287
"""
288288
c1 = MyClassWizard.from_dict(data)
289289
c2 = factory.load(data_2, MyClass)

benchmarks/simple.py

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,15 @@ def test_load(data, n):
8181
"""
8282
[ RESULTS ON MAC OS X ]
8383
84-
benchmarks.simple.simple - [INFO] dataclass-wizard 0.033917
85-
benchmarks.simple.simple - [INFO] dataclass-factory 0.103837
86-
benchmarks.simple.simple - [INFO] dataclasses-json 3.941902
87-
benchmarks.simple.simple - [INFO] jsons 5.636863
88-
benchmarks.simple.simple - [INFO] dacite 0.572661
89-
benchmarks.simple.simple - [INFO] pydantic 0.081108
90-
benchmarks.simple.simple - [INFO] marshmallow 2.550217
91-
benchmarks.simple.simple - [INFO] attrs 0.022822
92-
benchmarks.simple.simple - [INFO] mashumaro 0.046641
84+
benchmarks.simple.simple - [INFO] dataclass-wizard 0.030784
85+
benchmarks.simple.simple - [INFO] dataclass-factory 0.103156
86+
benchmarks.simple.simple - [INFO] dataclasses-json 3.512702
87+
benchmarks.simple.simple - [INFO] jsons 4.709339
88+
benchmarks.simple.simple - [INFO] dacite 0.468830
89+
benchmarks.simple.simple - [INFO] pydantic 0.071347
90+
benchmarks.simple.simple - [INFO] marshmallow 2.155037
91+
benchmarks.simple.simple - [INFO] attrs 0.020167
92+
benchmarks.simple.simple - [INFO] mashumaro 0.041291
9393
"""
9494
g = globals().copy()
9595
g.update(locals())
@@ -131,30 +131,18 @@ def test_dump(data, n):
131131
"""
132132
[ RESULTS ON MAC OS X ]
133133
134-
benchmarks.simple.simple - [INFO] dataclass-wizard 0.072549
135-
benchmarks.simple.simple - [INFO] asdict (dataclasses) 0.101621
136-
benchmarks.simple.simple - [INFO] dataclass-factory 0.087357
137-
benchmarks.simple.simple - [INFO] dataclasses-json 1.488334
138-
benchmarks.simple.simple - [INFO] jsons 8.550752
134+
benchmarks.simple.simple - [INFO] dataclass-wizard 0.024619
135+
benchmarks.simple.simple - [INFO] asdict (dataclasses) 0.093137
136+
benchmarks.simple.simple - [INFO] dataclass-factory 0.188235
137+
benchmarks.simple.simple - [INFO] dataclasses-json 1.294685
138+
benchmarks.simple.simple - [INFO] jsons 6.913666
139139
benchmarks.simple.simple - [INFO] dacite (not applicable) -- skipped
140-
benchmarks.simple.simple - [INFO] pydantic 0.080157
141-
benchmarks.simple.simple - [INFO] marshmallow 0.000578
142-
benchmarks.simple.simple - [INFO] attrs 0.146561
143-
benchmarks.simple.simple - [INFO] mashumaro 0.010199
140+
benchmarks.simple.simple - [INFO] pydantic 0.066996
141+
benchmarks.simple.simple - [INFO] marshmallow 0.000519
142+
benchmarks.simple.simple - [INFO] attrs 0.122752
143+
benchmarks.simple.simple - [INFO] mashumaro 0.008702
144144
"""
145145

146-
# [ RESULTS ]
147-
# benchmarks.simple.simple - [INFO] dataclass-wizard 0.065604
148-
# benchmarks.simple.simple - [INFO] asdict (dataclasses) 0.087785
149-
# benchmarks.simple.simple - [INFO] dataclass-factory 0.084215
150-
# benchmarks.simple.simple - [INFO] dataclasses-json 1.278573
151-
# benchmarks.simple.simple - [INFO] jsons 6.192119
152-
# benchmarks.simple.simple - [INFO] dacite (not applicable) -- skipped
153-
# benchmarks.simple.simple - [INFO] pydantic 0.066679
154-
# benchmarks.simple.simple - [INFO] marshmallow 0.000481
155-
# benchmarks.simple.simple - [INFO] attrs 0.122282
156-
# benchmarks.simple.simple - [INFO] mashumaro 0.009025
157-
158146
c1 = MyClassWizard.from_dict(data)
159147
c2 = factory.load(data, MyClass)
160148
c3 = MyClassDJ.from_dict(data)

dataclass_wizard/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
__all__ = [
7272
# Base exports
73+
'DataclassWizard',
7374
'JSONSerializable',
7475
'JSONPyWizard',
7576
'JSONWizard',
@@ -120,17 +121,17 @@
120121

121122
from .bases_meta import LoadMeta, DumpMeta, EnvMeta
122123
from .constants import PACKAGE_NAME
123-
from .dumpers import DumpMixin, setup_default_dumper, asdict
124+
from .dumpers import DumpMixin, setup_default_dumper
124125
from .loaders import LoadMixin, setup_default_loader
125-
from .loader_selection import fromlist, fromdict
126+
from .loader_selection import asdict, fromlist, fromdict
126127
from .models import (env_field, json_field, json_key, path_field, skip_if_field,
127128
KeyPath, Container,
128129
Pattern, DatePattern, TimePattern, DateTimePattern,
129130
CatchAll, SkipIf, SkipIfNone,
130131
EQ, NE, LT, LE, GT, GE, IS, IS_NOT, IS_TRUTHY, IS_FALSY)
131132
from .environ.wizard import EnvWizard
132133
from .property_wizard import property_wizard
133-
from .serial_json import JSONWizard, JSONPyWizard, JSONSerializable
134+
from .serial_json import DataclassWizard, JSONWizard, JSONPyWizard, JSONSerializable
134135
from .wizard_mixins import JSONListWizard, JSONFileWizard, TOMLWizard, YAMLWizard
135136

136137

0 commit comments

Comments
 (0)