Skip to content

Releases: loyada/typedpy

various improvements

17 Apr 07:57
Compare
Choose a tag to compare

#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

10 Dec 18:21
Compare
Choose a tag to compare

#67 Add Final class support for Structure. Make all predefined Immutable Fields/Structures Final.
#68 Add @unique support for both Structure and Field classes. Add "is_unique" optional parameter to Field to achieve the same effect.

minor bug fixes for new features introduced in 2.1.1

04 Dec 04:23
Compare
Choose a tag to compare

Improved immutability, more field types

03 Dec 14:10
Compare
Choose a tag to compare

#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

25 Nov 03:22
Compare
Choose a tag to compare

#63 Support nullables explicitly, including making it optionals automatically where appropriate

  • Bugfix for ImmutableList field type
    #50 Add tutorial /recipes

From v2.0.1:

#62 - Implicit wrappers for arbitrary types.

Allow usage of arbitrary classes as fields.

24 Nov 03:11
Compare
Choose a tag to compare

#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

20 Nov 23:57
Compare
Choose a tag to compare

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

01 Nov 18:40
Compare
Choose a tag to compare

Issue #46, #47, #48, #49

  1. 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.

  1. Every default value is now validated automatically by typedpy. The following code: a: Integer(minimum=10) = 5 immediately raises an appropriate exception.

minor improvements in serialization/copy

25 Oct 19:12
Compare
Choose a tag to compare

minor improvements for serialization

23 Oct 17:16
Compare
Choose a tag to compare