Skip to content

Releases: smarie/python-pyfields

1.0.0 - Stable version

16 Nov 17:24
Compare
Choose a tag to compare

Overall behaviour stabilized and compliance with @autoclass to cover most use cases.

The only bug that has not yet been fixed is #12

See documentation page for details.

0.14.0 - helpers, bugfix, and ancestor-first option in init makers

15 Nov 10:37
Compare
Choose a tag to compare

API

  • new helper methods get_field, yield_fields, has_fields and get_fields (new name of collect_all_fields) so that other libraries such as autoclass can easily access the various information. fix_fields removed. Fixed #48

  • New ancestor_fields_first option in all the __init__ makers (make_init and @init_fields). Fixed #50

Bugfixes

  • Bugfixes in all the __init__ makers (make_init and @init_fields):

    • bugfix in case of inheritance with override: #49

    • the argument order used for fields initialization (inside the generated init method body) was sometimes incorrect. This would trigger a bug when one field was requiring another one to initialize.

    • when the list of fields received by InitDescriptor was an empty tuple and not None, the constructor was not created properly

See documentation page for details.

0.13.0 - `nonable` fields

25 Oct 15:20
Compare
Choose a tag to compare
  • Fields can now be nonable, so as to bypass type and value validation when None is received. Fixed #44

See documentation page for details.

0.12.0 - Minor improvements

18 Oct 15:48
Compare
Choose a tag to compare
  • Now all type validation errors are FieldTypeError. Fixed #40.
  • Fixed bug with python < 3.6 where fields were not automatically attached to their class when used from within a subclass first. Fixed #41

See documentation page for details.

0.11.0 - Better initialization orders in generated `__init__`

18 Oct 09:38
Compare
Choose a tag to compare

Fixed fields initialization order in generated constructor methods:

  • the order is now the same than the order of appearance in the class (and not reversed as it was). Fixed #36.
  • the above is true, even in python < 3.6. Fixed #38
  • the order now takes into account first the ancestors and then the subclasses, for the most intuitive behaviour. Fixed #37.

See documentation page for details.

0.10.0 - Read-only fields + minor improvements

17 Oct 10:11
Compare
Choose a tag to compare

Read-only fields

  • Read-only fields are now supported through field(read_only=True). Fixes #33.

Misc

  • All core exceptions now derive from a common FieldError, for easier exception handling.
  • Now raising an explicit ValueError when a descriptor field is used with an old-style class in python 2. Fixes #34

See documentation page for details.

0.9.1 - Minor improvements

11 Oct 10:11
Compare
Choose a tag to compare
  • Minor performance improvement: Converter.create_from_fun() does not generate a new type everytime a converter needs to be created from a callable - now a single class ConverterWithFuncs is used. Fixed #32.

See documentation page for details.

0.9.0 - Converters

10 Oct 17:00
Compare
Choose a tag to compare

converters

  • Fields can now be equipped with converters by using field(converters=...). Fixes #5
  • New method trace_convert to debug conversion issues. It is available both as an independent function and as a method on Field. Fixes #31
  • New decorator @<field>.converter to add a converter to a field. Fixed #28.

misc

  • The base Field class is now exposed at package level.

See documentation page for details.

0.8.0 - PEP484 support

08 Oct 15:33
Compare
Choose a tag to compare

PEP484 type hints support

  • Now type hints relying on the typing module (PEP484) are correctly checked using whatever 3d party type checking library is available (typeguard is first looked for, then pytypes as a fallback). If none of these providers are available, a fallback implementation is provided, basically flattening Unions and replacing TypeVars before doing is_instance. It is not guaranteed to support all typing subtelties. Fixes #7

See documentation page for details.

0.7.0 - more ways to define validators

08 Oct 12:21
Compare
Choose a tag to compare

validators

  • New decorator @<field>.validator to add a validator to a field. Fixed #9.
  • Native fields are automatically transformed into descriptor fields when validators are added this way. Fixes #1.

See documentation page for details.