Dataclass-wizard

Latest version: v0.34.0

Safety actively analyzes 693883 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 11

0.34.0

-------------------

**Features and Improvements**

- **V1 Opt-in**
- Support for recursive types OOTB for the following Python types:
- ``NamedTuple``
- ``TypedDict``
- ``Union``
- ``Literal``
- Nested `dataclasses`
- `Type aliases`_ (introduced in Python 3.12+)
- Full support for ``bytes`` and ``bytearray`` in the de/serialization process (fixes :issue:`140`).
- Performance improvements: Optimized Load functions for ``bool``, ``NamedTuple``, ``datetime``, ``date``, and ``time``.
- Added support for `Type aliases`_ (via ``type`` statement in Python 3.12+).
- Improved logic in ``load_to_str`` to better check if it's within an ``Optional[...]`` type.
- Enhanced handling of sub-types in de/serialization (**TODO**: add test cases).
- Show deprecation warning for Meta setting ``debug_enabled`` (replaced by ``v1_debug``).

- Updated benchmarks for improved accuracy.

**Bugfixes**

- Fixed issue where code generation failed to correctly account for indexes, especially when nested collection types like ``dict`` were used within a ``NamedTuple``.
- ``make check`` now works out-of-the-box for validating ``README.rst`` and other RST files for PyPI deployment.
- :pr:`169`: Explicitly added ``utf-8`` encoding for ``setup.py`` to enable installation from source on Windows (shoutout to :user:`birkholz-cubert`!).

.. _Type aliases: https://docs.python.org/3/library/typing.html#type-aliases

0.33.0

-------------------

* Introduce ``v1`` opt-in, providing a more user-friendly experience with significant performance improvements for de-serialization 🎉
* Add models for ``v1``, imported from ``dataclass_wizard.v1``:
* :func:`Alias`
* :func:`AliasPath`
* Add enums for ``v1``, imported from ``dataclass_wizard.v1.enums``:
* :class:`KeyCase`
* :class:`KeyAction`
* Add ``Meta`` settings for ``v1``:
* ``v1`` — Enable opt-in for the "experimental" major release `v1` feature.
* ``v1_debug`` — Replaces the deprecated ``debug_enabled`` Meta setting, which will be removed in ``v1``.
* ``v1_key_case`` — Specifies the letter case used for matching JSON keys when mapping them to dataclass fields.
* ``v1_field_to_alias`` — Custom mapping of dataclass fields to their JSON aliases (keys) for de/serialization.
* ``v1_on_unknown_key`` — Defines the action to take when an unknown JSON key is encountered during :meth:`from_dict` or :meth:`from_json` calls.
* ``v1_unsafe_parse_dataclass_in_union`` — Unsafe option: Enables parsing of dataclasses in unions without requiring the presence of a :attr:`tag_key`.
* Require the ``typing-extensions`` library up to Python 3.11 (its main use in Python 3.11 is ``ReadOnly`` for ``TypedDict``).
* Phase out the ``UnknownJSONKey`` exception class in favor of ``UnknownKeysError``, since ``v1`` now provides *all* missing keys in JSON (not just the first one!).
* Update benchmarks:
* Add benchmark for ``CatchAll``.
* Move benchmark dependencies to ``requirements-bench.txt``.
* Add new test cases.

0.32.1

-------------------

**Bugfixes**

- Corrected logic in :class:`MappingParser` that assumed all parsers were
subclasses of :class:`AbstractParser` (:issue:`159`).
- Add test case to confirm intended functionality.
- Bump *dev* dependencies to latest version.

0.32.0

-------------------

**Features and Improvements**

- Add support for `ABC Containers`_ in ``typing`` and ``collections.abc``:
* ``Collection``
* ``Sequence``
* ``MutableSequence``

**Bugfixes**

- Fixed a bug in :class:`ParseError` handling.
- Resolved an issue in :class:`EnvWizard` where passing an instance of a dataclass field type to the constructor caused problems.
- Corrected logic in :mod:`parsers.py` that assumed all parsers were subclasses of :class:`AbstractParser`; parsers can now be functions as well.

.. _ABC Containers: https://docs.python.org/3/library/typing.html#aliases-to-container-abcs-in-collections-abc

0.31.0

-------------------

Happy Thanksgiving 🦃, y'all! In this release, Dataclass Wizard introduces the long-awaited :class:`EnvWizard` 😳🎉.


**Features and Improvements**

- :class:`EnvWizard`:
- Support for working with environment variables, secret files, and `.env` files.

- **New Functions and Helpers**:
- :func:`EnvMeta`: Helper function to set up the ``Meta`` Config for :class:`EnvWizard`.
- :func:`env_field`: Alias for ``dataclasses.Field()`` to set a custom environment variable for a field.
- **Helper Functions**:
- :func:`as_bool`, :func:`as_int`, :func:`as_str` optimized.
- :func:`as_list`, :func:`as_dict` added.

- **Meta Class Enhancements**:
- New meta classes such as :class:`AbstractEnvMeta`.
- New fields added to the ``Meta`` class:
- :attr:`env_var_to_field`
- :attr:`field_to_env_var`
- :attr:`debug_enabled`
- :attr:`recursive`
- :attr:`env_file`
- :attr:`env_prefix`
- :attr:`secrets_dir`
- :attr:`key_lookup_with_load`
- :attr:`key_transform_with_dump`
- :attr:`skip_defaults`
- :attr:`skip_if`
- :attr:`skip_defaults_if`

- **Benchmark Updates**:
- Updated benchmarks to include new libraries.
- Added the ``--all | -A`` option to benchmark tests for running longer tests against some libraries.

- **Documentation**:
- General documentation updates.

0.30.1

-------------------

**Bugfixes**

* Resolved inconsistent behavior with dataclasses in ``Union`` when ``Meta`` :attr:`tag_key`
is also defined as a dataclass field (:issue:`148`).

Page 1 of 11

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.