python-pyfields

Define fields in python classes. Easily.

BSD-3-CLAUSE License

Downloads
50.3K
Stars
45
Committers
2

Bot releases are visible (Hide)

python-pyfields - 1.7.2 - bugfix Latest Release

Published by github-actions[bot] 12 months ago

  • Fixed TypeError: Neither typeguard not pytypes is installed even with typeguard installed. Fixed #91

See documentation page for details.

python-pyfields - 1.7.1 - Compatibility fix for typeguard `3.0.0`

Published by github-actions[bot] over 1 year ago

  • Fixed TypeError: check_type() takes 2 positional arguments but 3 were given triggering erroneous FieldTypeError
    when typeguard>=3.0.0 is used. Fixed #87

See documentation page for details.

python-pyfields - 1.7.0 - Better support for non-deep-copiable default values in `@autofields`

Published by github-actions[bot] over 3 years ago

  • @autofields and @autoclass now raise an error when a field definition can not be valid, because the default value can not be deep-copied. This will help users detect issues such as #84 earlier. Implementation is done through a new autocheck option in the copy_value factory.

  • @autofields and @autoclass now provide an exclude (resp. af_exclude) list, to list names for fields that should not be created. By default this contains a reserved name from abc.ABCMeta, for convenience. Fixes #84.

See documentation page for details.

python-pyfields - 1.6.2 - CI/CD migration

Published by github-actions[bot] over 3 years ago

  • This is a technical release with no code change, to validate the new Github Actions workflow.

See documentation page for details.

python-pyfields - 1.6.1 - Bugfix

Published by smarie almost 4 years ago

  • Fixed an issue with autofields (and therefore autoclass too) where a field would be mistakenly recreated on a subclass when that subclass does not define type hints while the parent class defines type hints. Fixes #81

See documentation page for details.

python-pyfields - 1.6.0 - we now have our own version of `@autoclass`

Published by smarie about 4 years ago

  • Copied the relevant contents from autoclass so as to get rid of the dependency. Since we are in a pyfields context there were many things that could be dropped and remaining code could be easily copied over. Also took this opportunity to replace the dict view with a to_dict/from_dict pair of methods, this seems less intrusive in the class design. Finally the parameter names have been simplified, see API reference for details. Fixes #79

See documentation page for details.

python-pyfields - 1.5.0 - updated `@autoclass` signature

Published by smarie about 4 years ago

  • Improved @autoclass so that it is much easier to access the relevant arguments from underlying @autofields and @autoclass. Fixed #78

See documentation page for details.

python-pyfields - 1.4.0 - new `@autoclass` decorator

Published by smarie about 4 years ago

  • New @autoclass decorator directly available from pyfields. It is merely equivalent to the original @autoclass with option autofields=True, which makes it easier to use on classes with automatic fields. Fixes #75

See documentation page for details.

python-pyfields - 1.3.1 - bugfix

Published by smarie about 4 years ago

  • Fields order are preserved by @autofields even in the case of a field with just a type annotation. Fixed #76

See documentation page for details.

python-pyfields - 1.3.0 - Support for Forward references, PEP563 and class-level access

Published by smarie about 4 years ago

  • String forward references in type hints, and PEP563 behaviour, is now supported. When this case happense, the type hint resolution is delayed until the field is first accessed. Fixes #73

  • Accessing a field definition from a class directly is now enabled, since PyCharm fixed their autocompletion bug. Fixes #12

See documentation page for details.

python-pyfields - 1.2.0 - `getfields` improvements and new `get_field_values`

Published by smarie over 4 years ago

  • getfields can now be executed on an instance, and provides a public_only option. Fixes #69

  • New get_field_values method to get an ordered dict-like of field name: value. Fixes #70

See documentation page for details.

python-pyfields - 1.1.5 - bugfix

Published by smarie over 4 years ago

  • @autofields now correctly skips @property and more generally, descriptor members. Fixes #67

See documentation page for details.

python-pyfields - 1.1.4 - better python 2 packaging

Published by smarie over 4 years ago

  • packaging improvements: set the "universal wheel" flag to 1, and cleaned up the setup.py. In particular removed dependency to six. Fixes #66

See documentation page for details.

python-pyfields - 1.1.3 - smaller wheel

Published by smarie over 4 years ago

  • tests folder is now excluded from generated package wheel. Fixed #65

See documentation page for details.

python-pyfields - 1.1.2 - type hint fix (minor)

Published by smarie over 4 years ago

  • Now converters={'*': ...} does not appear as a type hint error. Fixed #64

See documentation page for details.

python-pyfields - 1.1.1 - PEP561 compatibility

Published by smarie almost 5 years ago

  • Misc: Package is now PEP561 compatible. Fixed #61

See documentation page for details.

python-pyfields - 1.1.0 - @autofields and default values improvements

Published by smarie almost 5 years ago

  • New @autofields decorator. This decorator can be used to drastically reduce boilerplate code, similar to pydantic and attrs. This is compliant with python 2.7 and 3.5+ but is more useful when the type hints can be provided in class member annotations, so from 3.6+. Fixed #55

  • Default values are now validated/converted as normal values. If the default value is provided in default=<value> or as a default_factory=copy_value(<value>), this is done only once per field, to accelerate future access. If the value was converted on the way, the converted value is used to replace the default value, or the default value copied by the factory. Fixed #57

  • Misc: removed makefun usage in validate_n_convert.py : was overkill. Also fixed a few type hints.

See documentation page for details.

python-pyfields - 1.0.3 - bugfix

Published by smarie almost 5 years ago

  • Fixed bug with super().__init__ not behaving as expected. Fixed #53

See documentation page for details.

python-pyfields - 1.0.2 - bugfixes

Published by smarie almost 5 years ago

  • User-provided nonable status was wrongly overriden automatically when the field was attached to the class. Fixed #51
  • Fixed an issue with type validation when typeguard is used and a tuple of types is provided instead of a Union. Fixed #52

See documentation page for details.

python-pyfields - 1.0.1 - `pyproject.toml`

Published by smarie almost 5 years ago

Added pyproject.toml

See documentation page for details.

Package Rankings
Top 7.09% on Pypi.org
Badges
Extracted from project README
Python versions Build Status Tests Status Coverage Status codecov Flake8 Status Documentation PyPI Downloads Downloads per week GitHub stars