- Update all project dependencies and fix all deprecated warnings. Python 3.6 support was dropped to allow updating deprecated dependencies. #161
It is now possible to use type-variant generics in your dataclasses, such as
Sequence
orMutableSequence
instead ofList
,Mapping
instead ofDict
, etc.This allows you to hide implementation details from users of your dataclasses. If a field in your dataclass works just as fine with a tuple as a list, you no longer need to force your users to pass in a
list
just to satisfy type checkers.For example, by using
Mapping
orMutableMapping
, users can passOrderedDict
to aDict
attribute without MyPy complaining.@dataclass class OldWay: str_list: List[str] num_map: Dict[str, float] # MyPy will reject this even though Marshmallow works just fine. If you use # type-variant generics, MyPy will accept this code. instance = OldClass([], collections.ChainMap(MY_DEFAULTS)) @dataclass class NewWay: str_list: List[str] # Type-invariants still work num_map: MutableMapping[str, float] # Now generics do too
- Schemas no longer copy non-field dataclass attributes. Thanks to @sveinse for report and test. #79
- Additional metadata are supported in ib() and fields(). Thanks to @sveinse for reporting and testing. #28
- Add support for attrs factories that take
self
(attr.Factory(..., takes_self=True)
). #27
- Add support for Tuple[int, ...] per https://docs.python.org/3/library/typing.html#typing.Tuple #16 Thanks to @sveinse for reporting and testing.
- Use module imports internally. #18
- Desert version only needs to be updated in _version.py #19
- Fix doctests. #20
Optional
fields allowNone
. #11. Thanks to @sveinse for reporting and testing.
- Improve error message for unknown generics. #10
- Add
UnknownType
exception with better error message for types that should be generic. #8
- Marshmallow schema
Meta
arguments are accepted, allowing exclusion of unknown fields and other options. #3
- Add twine and wheel development dependencies. #2
- Switch to calver
- Non-optional fields without a default or factory now have required=True so raise :class:`marshmallow.exceptions.ValidationError` when missing. #1
- First release on PyPI.
---