Releases: loyada/typedpy
various improvements
#69 allow bound method to be accepted as a value for field of type "Function"
#70 allow to ignore assignment of None to a field. Useful when mapping from SQLAlchemy
#71 Optional parameter to serializer/deserializer to convert between snake-case field names and camelCase. Useful when mapping between python names and names in Java/ Javascript, which use camelCase names
#72 Fix a bug in Structure.fields_by_name() when using the syntax of field annotations.
#73 clone a structure with overrides. Useful especially when you have an immutable structure, and you want to create another instance that is similar, but not identical.
#74 expose mapping from exception String to a well formed structure for error info. Useful when the calling service/function needs a consistent way of handling errors
Uniqueness and "Final" Structures
minor bug fixes for new features introduced in 2.1.1
Improved immutability, more field types
#65 - Add the following types: Generator, Deque, ImmutableDeque. Also support automatic conversion of collections.deque to a field type.
#66 block nested updates of immutables explicitly (raise an exception). For example, if we have m: ImmutableMap[String, Deque], then attempting to update the nested deque values will raise exception. Previously it failed silently, but that's confusing for a developer.
Nullables, optionals, and implicit class wrapper
Allow usage of arbitrary classes as fields.
#62 Implicit wrapper of non-typedpy classes. This is a major improvement that allows the use of arbitrary classes in fields.
For example:
Assume we created class Point.
We can define the following structure:
class Example(ImmutableStructure):
my_point: Field[Point]
other_points: Array[Point]
# note: instead of Array above, we could have used typing.List, or list. The behavior would be the same.
And it will magically work as though Point was a Typepy Field class. The exception is that it does not support pickling, and serialization is on a best-effort basis.
Major release - dataclass-like syntax , imutability, more
Issue #50 - improved documentation. Tutorial is still a work in progress
Issue #51 - support common types from typing module
Issue #52 - Support for 3.9.
Issue #53 Support PEP-585 for the basic collections (list, dict, tuple, set)
Issue #54 Support typing.union
Issue #55 Improvements for immutables
Issue #56 Support definition optional fields instead of required
Issue #57 ensure immutability of immutable structures using defensive deep copies
Issue #58 For Array, Map override all self mutating methods to protect against unvalidated updated
Issue #59 Explicit support for ImmutableSet using fronzenset. This is preferable to set with protections because its API does not have methods for updates, so it is more developer-friendly
Issue #60 Define basic immutable fields ImmutableMap, ImmutableArray, ImmutableSet etc
Issue #61 Bugfix - Iterators bypassing validation and immutability guards for array, map
improved syntax and handling of defaults
- Introduce dataclass-like syntax, as an alternative. In addition, this includes:
- Automatic conversion of python basic typed to typedpy classes
- Support for default values, in the standard Python format, i.e. a: Array[String] = ['xx', 'yy']
- the "_required" attribute is updated automatically to reflect fields with default values. In other words: if a field has a default, then it is optional in the constructor.
Backward compatibility with standard Typedpy syntax is maintained.
- Every default value is now validated automatically by typedpy. The following code: a: Integer(minimum=10) = 5 immediately raises an appropriate exception.