Changelog¶
2.2.0 - autoclass enhancements¶
@autoclassnow provides anautofieldsargument to applypyfields.autofieldsautomatically before applying autoclass. Fixes #38@autoclassnow removes private fields from the generated autodict representation by default. Fixes #37
2.1.5 - python 2 packaging improvements¶
- setup improvements: set the universal wheel flag to 1, and cleaned up the setup.py. Fixes #36
2.1.4 - Packaging improvements¶
setup.pyimprovements: now includingpy.typed, excludingtestsfolder, and usingzip_safe=False
2.1.3 - Fixed DeprecationWarning¶
- Fixed DeprecationWarning. Fixed #35
2.1.2 - bugfix¶
Fixed bug happening when pyfields is not installed. Fixed #33.
2.1.1 - pyproject.toml¶
Added pyproject.toml.
2.1.0 - @autoeq¶
Features
- Added independent
@autoeq, supported in@autoclassand automatically activated whenautodict=False. Fixed #32.
Bugfixes
-
Fixed
@autoreprwhenonly_known_fieldsisFalse: now property names are correctly used instead of the private names. -
Fixed
@autodict's generated__eq__method: when the other object is a dictionary a direct comparison is now done before trying super.
2.0.0 - pyfields support + major refactoring¶
Features
-
default string representation in
@autodictis now more readable. Legacy representation is still available through a parameter. Fixed #29. -
pyfieldscan now be used as the source for the list of attributes, in@autohash,@autodict, and@autoclass. Fixes #28 -
new
@autoreprdecorator. Previously this feature was only available through@autodict, it can now be used without it.autorepris supported in@autoclass, and if users setautodict=Falseby default it will be enabled. Fixed Fixed #30 and #31.
Misc / bugfixes
-
Major refactoring: more readable and maintainable code.
-
Fixed
@autodictbehaviour when the list wasvars(self)and used together with@autoprops: with some options the private names were appearing and with others the public property names were appearing. Now the public property names always appear if they exist.
1.18.0 - @autoslots¶
New @autoslots feature, that can also be used from @autoclass by setting (autoslots=True). Fixes #9
1.17.2 - Added __version__ attribute¶
Added __version__ attribute at package level.
1.17.1 - Fixed bug with latest valid8¶
- Fixed
ValidationErrorhappening in all use cases. Fixed #25.
1.17.0 - Fixed include/exclude behaviour concerning property attributes¶
- Names used in
includeandexcludeare now correctly taken into account byautodictandautohasheven if the names correspond to property names and therefore the actual attributes names start with an underscore. Fixes #21
1.16.0 - Python 2 support¶
- This library now works on python 2.7, 3.5, 3.6 and 3.7. Fixes #3.
1.15.1 - fixed valid8 exception message¶
- Fixed #24
1.15.0 - more tolerance for inherited constructors¶
autodict,autohashandautopropsnow tolerate inherited constructors
1.14.0 - submodule name changes¶
- The submodule names were conflicting with the variable names: renamed them all
- The init file has been improved so as not to export symbols from other packages. Fixes #23
1.13.0 - @autodict_override¶
- New annotation
@autodict_overridethat you can use to override__iter__,__getitem__or__len__. Fixes #22
1.12.0 - autodict fix¶
- In case of inheritance, the order of attributes in now better and reproductible. Fixes #20
- Printed representation created by @autodict now uses the same order than the generated keys iterator on the dictionary-faceted object.
1.11.0 - autodict fixes¶
@autodictdoes not add thefrom_dictclass method anymore if this method already exists. If it does not already exist however, it is now always created (even ifonly_constructor_args=False)- inheritance is now handled more correctly (not perfect but it seems to handle more cases) with
@autodict. Fixes #19
1.10.2 - minor bugfix¶
- Fixed #18
1.10.1 - compatibility¶
- Now compliant with old versions of
typingmodule:typing.Typeis not imported explicitly anymore. - tests updated with latest version of
valid8
1.10.0 - bugfixes and updated doc¶
- Updated documentation main page
@autoargsbehaviour wrt keyword arguments changed. See usage page for details.includeandexcludeparameters now support any kind of sequence, in all decorators- Bugfix: Setter is called twice for default values
- Bugfix: @autoprops argument name in setter is not correct
1.9.2 - added autohash + fix¶
- new annotation
@autohash - The equality method
__eq__generated by@autodictis now correct @autodict: fixed consistency with default values ofonly_public_fields: it was False when using the individual decorator, but True when using @autoclass global decorator or the manual decoration method. Now it is True everywhere.
1.9.1 - a few fixes¶
- Now compliant with valid8 2.0.0
- Fixed #13: now generated setters have default values when it was the case on the constructor.
1.9.0 - valid8 is now an independent project¶
Boolean,validate,validate_decorateand all validators have been moved to an independent project, thus decouplingautoclassfrom the choice of validator library.
1.8.1 - minor improvements¶
- Now detecting conflicts with
enforcewhen annotations are not in the right order (see #12) - Added tests for
on_each_andon_all_and fixed corresponding bugs.
1.8.0 - new validators for collections¶
- Added
on_each_andon_all_
1.7.1 - bug fix: lts validator¶
ltswas erroneously mappend ontogt. Fixed this.
1.7.0 - @autoclass¶
- New decorator
@autoclassto apply several features at once. @autodictnow also generates afrom_dictstatic method in the class, as well as__str__,__repr__and__eq__if not present
1.6.0 - @autodict¶
- New decorator
@autodictto make a class behave like a (read-only) dict. So this is a 'dict view' on top of an object, basically the opposite ofmunch(that is an 'object view' on top of a dict)
1.5.0 - Robustness and minor improvements¶
- better error messages for set enforcers
- uniform management of validators lists: now passing a list creates an 'and_' operator behind the scenes
- better handling of empty lists
- and, or, xor now automatically replace themselves with their contents when their contents is a single validator
- added a few tests to improve coverage (hopefully)
1.4.3 - User-friendly validators error messages¶
- better validation error messages for parametrized validators
1.4.2 - Improved and documented validators¶
- improved validators list documentation
- added new validator:
and_ - fixed bugs in
or_,not_, andxor_: since custom validators may now throw exceptions other thanValidationErrorand may returnNone, there was a need to update them to take these cases into account not_may now be applied to a list of validators (implicitand_)- more unit tests for boolean validators
1.4.1 - Improved and documented validation feature¶
- A validator function may now return
None - improved documentation on
@validatein particular for custom validators implementation
1.4.0 - Added validation feature¶
- New:
@validateannotation allowing to implement input validation. Comes with a bunch of built-in validators.
1.3.1 - Documentation and Travis integration 2¶
- Improved documentation
- Automatic test report generation in travis
- Automatic PyPI deployment on tags in travis
1.3.0 - Project renaming¶
classtools-autocodeProject was renamedautoclassfor clarity- Travis configuration was updated accordingly
1.2.0 - Performance and documentation¶
- improved examples in the documentation
- improved performance of var_checker (lessons learnt from parsyfiles)
1.1.0 - Mkdocs and enforce¶
- now using mkdocs to generate the documentation from markdown
@autoprops: generated getters and setters now have correct PEP484 signature, which makes the library compliant withenforce- updated documentation accordingly