Releases: smarie/python-pyfields
1.0.0 - Stable version
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
API
-
new helper methods
get_field
,yield_fields
,has_fields
andget_fields
(new name ofcollect_all_fields
) so that other libraries such asautoclass
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 notNone
, the constructor was not created properly
-
See documentation page for details.
0.13.0 - `nonable` fields
- Fields can now be
nonable
, so as to bypass type and value validation whenNone
is received. Fixed #44
See documentation page for details.
0.12.0 - Minor improvements
- 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__`
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
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
- Minor performance improvement:
Converter.create_from_fun()
does not generate a newtype
everytime a converter needs to be created from a callable - now a single classConverterWithFuncs
is used. Fixed #32.
See documentation page for details.
0.9.0 - Converters
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 onField
. 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
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, thenpytypes
as a fallback). If none of these providers are available, a fallback implementation is provided, basically flatteningUnion
s and replacingTypeVar
s before doingis_instance
. It is not guaranteed to support alltyping
subtelties. Fixes #7
See documentation page for details.
0.7.0 - more ways to define validators
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.