Dataclass-wizard

Latest version: v0.35.0

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

Scan your dependencies

Page 1 of 11

0.35.0

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

**Features and Improvements**

* **V1 Opt-In:**
* Add support for Patterned Date and Time:
* Naive Date/Time/Datetime
* Timezone-aware Time/Datetime
* UTC Time/Datetime
* Update :func:`Alias` and :func:`AliasPath` to support multiple aliases and nested path(s)
* Update the ``KeyCase.AUTO`` setting (specified via ``v1_key_case='AUTO'``) to correctly
handle multiple possible keys for the field (e.g., it doesn't latch onto the first encountered key but now
tries all valid key case transformations at runtime). This now results in expected or desired behavior (fixes :issue:`175`)
* **Float to Int Conversion Change**: In V1 Opt-in (via ``Meta`` setting ``v1=True``), floats or float strings
with fractional parts (e.g., ``123.4`` or ``"123.4"``) are no longer silently converted to integers.
Instead, they now raise an error. However, floats without fractional parts (e.g., ``3.0`` or ``"3.0"``)
will continue to convert to integers as before.
* Add documentation:
* Patterned Date and Time
* Aliases
* Add tests for coverage
* Optimize logic for determining if an annotated type is a ``TypedDict``
* Update ``requirements-bench.txt`` to correctly capture all Benchmark-related dependencies

**Bugfixes**

* Ensure the ``py.typed`` marker is included in the source distribution (fixes :issue:`173`)
* Address a minor bug in object path parsing that did not correctly interpret quoted literal values
within blocks such as braces ``[]``

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.

Page 1 of 11

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.