v0.4.0 - Links, Dictionary property, and more
Backwards-Incompatible Changes
-
Container properties no longer use an empty container as their
_class_default; instead, the class default isproperties.undefined, like all other built-in property types. This gives consistent behavior across all built-in property defaults. It also avoids unexpected problems with validation outlined in #169. (See #219)In order to update code from
properties v0.3.5tov0.4.0, you may simply add the appropriate default on each container property. For example:import properties assert properties.__version__ == '0.3.5' class MyClass(properties.HasProperties): my_list = properties.List( doc='List of strings', prop=properties.String(''), )
behaves identically to
import properties assert properties.__version__ == '0.4.0' class MyClass(properties.HasProperties): my_list = properties.List( doc='List of strings', prop=properties.String(''), default=list, )
Major New Features
- New
Dictionaryproperty. (See #188, issue #165) linkanddirectional_linkobjects allow values for properties (and traits) across HasProperties (and HasTraits) instances to be linked. The API for links mimics that from traitlets: http://traitlets.readthedocs.io/en/stable/utils.html#links. (See #155)properties.Boolhas been renamedproperties.Booleanto normalize naming conventions across the library (e.g. the integer property isproperties.Integer, notproperty.Int). (See #209)
Minor Changes
- Properties may now be private (i.e. names may begin with underscore). (See #194, issue #191)
- Container properties may now leave
propunspecified for untyped contents. (See #188) - Array properties:
- Dynamic properties:
- Renamed properties now have an option to not raise a warning. (See #203, issue #201)
stop_recursion_withutil function has been deprecated. (See #204, issue #168)- Docstring improvements:
Bug Fixes
- For container properties, when an instance of a subclass of the base container type are assigned to a property, their class is now maintained (e.g.
OrderedDictis no longer coerced to standarddictonvalidate). (See #221) defaultvalue validation no longer fails due to the order which property attributes are set. (See #186, issue #177)properties.copynow maintains classes of the original. (See #184, issue #175)- Union properties with
required=Falseno longer fail validation when unset. (See #199, issue #198) - Deserialization from dictionary that includes a renamed property no longer fails. (See #217)
- Conflicts can no longer arise from setting dynamic properties on init. (See #187, issue #173)
- Metaclass setup no longer fails if
__setattr__is overridden. (See #158) - Sphinx linking for custom property classes now works. (See #156, issue #153)