Recent Releases of properties

properties - v0.6.1 - Support np.bool_ in Boolean.from_json

Bug Fixes

  • properties.Boolean.from_json now allows np.bool_ values in the input JSON. (See #289 - thanks @lheagy !)

- Python
Published by fwkoch over 6 years ago

properties - v0.6.0 - Fix Diamond Inheritance, Allow Unsigned Int Arrays

Minor Changes

  • properties.Array now supports unsigned integer arrays. (See https://github.com/seequent/properties/issues/274)
  • coerce is added as a new keyword argument for properties.Array. By default, this is True and inputs are coerced to the corresponding numpy array class, matching previous behaviour. However, if coerce=False inputs are not coerced and a ValidationError is raised if they do not match the corresponding numpy array class. (See https://github.com/seequent/properties/issues/272)
  • Properties defined on mixin classes which use the PropertyMetaclass but do inherit HasProperties are now respected. (See https://github.com/seequent/properties/pull/283 - thanks @hishnash!)
  • Explicit support added for Python 3.7 and removed for 3.4. (See https://github.com/seequent/properties/pull/281)

Bug Fixes

  • Order of property resolution for HasProperties classes with diamond inheritance was fixed to be more sensible and in line with attribute resolution for object diamond inheritance. Although this is considered a fix, it does fundamentally change inheritance logic for existing classes with diamond inheritance and is therefore not backwards compatible. (See https://github.com/seequent/properties/issues/275 and additional conversation https://github.com/seequent/properties/pull/276)
  • Ensure ValidationErrors with no reason/prop/instance are not ignored. (See https://github.com/seequent/properties/issues/271)

- Python
Published by fwkoch over 6 years ago

properties - v0.5.6 - Speed up Vector3Array validation

Bug fix

  • Vector3Array validation is simplified to not include the check for string representations (e.g. 'up', 'east') if using a numpy array. This vastly speeds up validation for large arrays since we no longer must iterate through every value. This fix is already present in Vector2Array. See gmggroup/omf#43

- Python
Published by fwkoch almost 7 years ago

properties - v0.5.5 - Better Error Messaging

New Feature

  • Improved ValidationError messaging, including more details on property errors and info about underlying errors on Union and Instance property validation (See: https://github.com/seequent/properties/pull/261)

Bug Fixes

  • Remove functools.wraps on serializer/deserializer functions to fix Python 2 bug (See: https://github.com/gmggroup/omf/issues/30 and https://github.com/seequent/properties/pull/265)

- Python
Published by fwkoch about 7 years ago

properties - v0.5.4 - URL property under web extras

New Features

  • New URL property under web extras

Bug Fixes

  • Fix typo in Pointer uid_prop getter

- Python
Published by fwkoch over 7 years ago

properties - v0.5.3 - Task refactor, minor bug fixes

Minor Changes

  • properties.extras.Task has been refactored for more distinction between inputs/outputs and the task itself (see #252 for slightly more context).

Bug Fixes

  • Container property names now propagate to prop when the default is used (see #254).
  • Custom serializer/deserializer functions that allow kwargs now respect provided kwargs rather than ignoring them (see #253).

- Python
Published by fwkoch over 7 years ago

properties - v0.5.2 - Unpin vectormath

Minor Updates

  • Unpin vectormath dependency to allow any release >=0.1.4 (see #247).
    • This is in response to the vectormath update from version 0.1.4 to 0.2.0, which introduced some backwards-incompatible changes (see the release notes). Now, either version of the library may be used with properties

- Python
Published by fwkoch over 7 years ago

properties - v0.5.1 - Make picklable, fix union deserialization

Minor Changes

  • Pickling HasProperties instances works better now. They no longer override __reduce__ and __setstate__, and instead are just tweaked so the default pickle behavior is satisfactory (see #243).

Bug Fixes

  • Bug where union deserialization leads to invalid state has been fixed (see #245).

- Python
Published by fwkoch over 7 years ago

properties - v0.5.0 - Better validation errors, new extras, Union property tweaks

Backwards-Incompatible Changes

  • Union property deserialization has been improved more reliably reconstruct correct instances (see #228)
    • This requires new strict_instances attribute on Union properties
    • It also adds strict and assert_valid on deserialize, instead of `verbose.
    • There is no guarantee that Union properties behave identically to their previous behaviour.
  • Task classes are moved from properties.task.Task to properties.extras.Task

Major Features

  • New ValidationError is raised when validation fails (see #224)
    • This is a subclass of ValueError
    • Multiple validation errors are now collected and raised together in one error description.
    • There is also an error hook called on validation error to customize error behaviour
  • New extras classes:
    • HasUID and Pointer (see #234)
    • Singleton (see #227)

- Python
Published by fwkoch over 7 years ago

properties - 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 is properties.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.5 to v0.4.0, you may simply add the appropriate default on each container property. For example:

    ```python 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 python 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 Dictionary property. (See #188, issue #165)
  • link and directional_link objects 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.Bool has been renamed properties.Boolean to normalize naming conventions across the library (e.g. the integer property is properties.Integer, not property.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 prop unspecified for untyped contents. (See #188)
  • Array properties:
    • shape may now be unspecified (if set to None) or have multiple valid values (if set to a set of valid shapes). Vector array properties may also specify specific shapes, as long as the second dimension is correct. (See #195, issue #192)
    • complex is now a valid dtype. (See #215, issue #208)
  • Dynamic properties:
    • May be serialized with a HasProperties instance by specifying save_dynamic=True. (See #202)
    • No longer raise an error if they evaluate to None/undefined. (See #187, issue #173)
  • Renamed properties now have an option to not raise a warning. (See #203, issue #201)
  • stop_recursion_with util function has been deprecated. (See #204, issue #168)
  • Docstring improvements:
    • __IPYTHON__ interrogation to determine sphinx or plain text formatting. (See #156)
    • Better wording on limited-size container properties. (See #185, issue #178)
    • Custom docs for renamed properties. (See #207)

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. OrderedDict is no longer coerced to standard dict on validate). (See #221)
  • default value validation no longer fails due to the order which property attributes are set. (See #186, issue #177)
  • properties.copy now maintains classes of the original. (See #184, issue #175)
  • Union properties with required=False no 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)

- Python
Published by fwkoch about 8 years ago

properties - v0.3.5 - Revert length conditionals

Bug Fixes

  • v0.3.4 attempted to clean up some code that looked like if len(val) > 0: to just if val:. This works for lists, but not np.ndarrays since they have a different way of determining truth. This release reverts these changes back to checking length.

- Python
Published by fwkoch over 8 years ago

properties - v0.3.4 - ARANZ Branding

Minor Changes

  • Properties has been moved under ARANZ Geo Limited branding
  • auto_create on Instance property has been deprecated (to be removed in a future release)
    • Instead of using auto_create, the instance class should be specified as default. This will maintain identical behavior.

- Python
Published by fwkoch over 8 years ago

properties - v0.3.3 - Modifications to equal and new copy function

Major Features

  • New properties.copy function that returns a copy of a HasProperties instance. This method uses serialize and deserialize to create the new instance. (see #147)
  • HasProperties.equal has been moved to properties.equal (see #147)
    • This function determines if all property values on two HasProperties instances are equal
    • The movement to a top-level function from HasProperties method sets a precedent for keeping the HasProperties class namespace clean

Minor Changes

  • Constraints placed on equal input so None and properties.undefined never reach equal (see #151)
  • Backwards-compatibility warning - For consistency, in the change notification dictionary previous is now properties.undefined rather than None if the property value is not defined. This now matches the existing behavior of value in the change notification dictionary being properties.undefined rather than None if the value is deleted. (see #151)

Bug Fixes

  • properties.Property.equal could return an iterator rather than a boolean given certain inputs (eg numpy arrays). This method now ensures iterators are reduced to a single boolean. (see #151)

- Python
Published by fwkoch almost 9 years ago

properties - v0.3.2 - Fix intersphinx class links

Bug Fixes

  • Fix links in autogenerated docstrings so they point correctly to the new docs introduced in v0.3.1 (see https://github.com/3ptscience/properties/pull/145)

- Python
Published by fwkoch almost 9 years ago

properties - v0.3.1 - Many New Features: DynamicProperty, Set/Tuple, equal method, etc.

Major Features

New Property types

  • File Property - New Property validated as a file or file name. May provide mode to use for opening a file - if None, file must already be open. Also may provide valid_modes for files that are already open - if None, any mode (or file-like objects without mode like BytesIO) will be valid. (see #100)
    • ImagePNG Property is now a subclass of File. (see #118)
  • DynamicProperty - New Property created when another property wraps a method. Behaves much like @property, where you can register setters and deleters that use other Properties. DynamicPropertys are never saved to the class. (see #108)
  • Set and Tuple Properties - New Properties with set and tuple underlying data structures. (see #125)
  • Renamed Property - for aiding backwards compatibility. (see #126)

Other features

  • equal method on Property classes and HasProperties
    • This determines if two valid Property values are equal. It is used with HasProperties validation to ensure values have been set and validated correctly. (see #124)
    • Backwards-Compatibility Warning - HasProperties validate is now more strict. Rather than simply confirming properties are valid, it confirms that they are valid AND equal to their validated value. This difference is subtle and unlikely to be a problem under normal use. It provides one extra layer of checking that everything was set properly.
    • New observer handler that only fires on change, rather than set. use kwarg change_only=True. (see #125)
  • regex attribute for String Property - If regex is specified, re.search on the input string must match the regular expression. (see #117)
  • Modifications to StringChoiceProperty (see #120):
    • descriptions attribute - set this to a dictionary with choice keys and description values for improved documentation
    • case_sensitive attribute - determines if choice case should be enforced or just coerced
    • order of choices is now preserved (if applicable)
  • coerce attribute for container properties (List, Tuple, Set) that if True, allows other container types or individual values (not in a container) as inputs, all of which are coerced to the appropriate container. (see #125)
  • observe_mutations attribute for List and Set Properties (see #127)
    • This uses custom container classes that HasProperties change notifications when mutated
    • Pros: more reliable notifications, Cons: containers are repeatedly copied (bad for large lists/sets)
  • New method decorator to stop_recursion_with a specified value if a method gets called recursively on the same HasProperties instance. (see #121)
  • New listeners_disabled/observers_disabled/validators_disabled context managers for disabling validate and observe handlers. (see #123, #125)
  • Enormous overhaul to sphinx docs and docstrings to make the online documentation much more useful. (see #136)
    • Backwards-Compatibility Warning - Intersphinx-linked documentation for projects implementing HasProperties will need to rebuild their documentation for links to be correct.

Minor Changes

  • Backwards-Compatibility Warning - info_text and info() have been modified to class_info and info respectively. HasProperties with the former attributes will raise a FutureWarning but still work for now. (see #116)
  • Tasks now have a built-in status report callback (see #122)
  • Improved error messaging when instance is None and validation of Property attributes. (see #116)
  • Improved automatic docstring formatting - no longer dependent on Sphinx formatting. (see #119)
  • Instance Properties now support old-style classes. (see #116)
  • _defaults may now contain properties.undefined to override previous default values with no default value. (see #136)

Bug Fixes

  • Fixed bug where array validation was not raising an error if the array.type.kind was not 'i', 'f', or 'b' (see #107)

- Python
Published by fwkoch about 9 years ago

properties - v0.3.0 - Major update: Serialization, Defaults, Metadata, etc.

Major Features

  • Serialization:
    • Note: as_json has been renamed to_json for better parallels between from_json and to_json
    • Currently serialization/deserialization uses JSON. This can be overridden by registering custom serializers and deserializers to Property instances, and possibly overriding serialize in a HasProperties subclass. All the serialization methods pass around any kwargs they receive. This allows more flexibility in custom serializers (for example, an open file can be passed around).
    • In HasProperties:
    • serialize creates a JSON dictionary of all the properties using the property serialize functions. This dictionary may have a __class__ key that stores the HasProperties class for smart deserialization.
    • deserialize takes a dictionary and creates a new instance of theHasProperties class using valid property keywords in the dictionary. If deserialize is used on trusted JSON, it will use the _REGISTRY to find the correct __class__ to construct. If the JSON is not trusted, deserialize constructs an instance of the class it is called on.
    • In Property classes and subclasses:
    • to_json is a static method that takes a valid property value and converts it to JSON-serializable version. If the value cannot be converted statically (ie a Property instance is required), this errors.
    • from_json is a static method that takes a JSON-serializable value and converts it to the a valid property value. Again, if a Property instance is required, this errors.
    • serialize takes a property value and serializes it using either the registered serializer, to_json, or Property-subclass-specific serialization logic.
    • deserialize takes a JSON value and deserializes it to a valid property value using either the registered deserializer, from_json, or Property-subclass-specific deserialization logic.
  • Defaults:
    • defaults wrapper has been removed. To implement dynamic defaults, specify a callable in the _defaults dictionary - this can no longer depend on self.
    • _defaults dictionary is now inherited. Any defaults not specified in a class will be inherited from parent classes.
    • This differs from old behaviour where _defaults overwrote parent class values for _defaults
    • default values are set before __init__ or with new function _reset. Deleting a property sets it to undefined.
    • This differs from old behavior where defaults were set on first get and deleting a property set it to default.
    • On init, defaults do not fire change notifications, kwargs do.
    • Additional validation of handlers and defaults in the metaclass.
  • Metadata tagging:
    • Properties can be tagged with additional arbitrary metadata. This is stored on the property in meta
    • e.g. properties.String('password').tag(encrypt=True)
  • Dependencies have been reduced for the base properties functionality. As a result, installation from PyPI has changed.
    • pip install properties only installs properties and the basic requirement six
    • pip install propreties[math] gets numpy and vectormath for the math properties (Array is now a math property)
    • pip install properties[image] gets image dependencies (ImagePNG is now native toproperties;properties_image` is no longer needed)
    • pip install properties[full] gets everything
  • Beta release support

Minor Changes

  • Overriding __init__ has been simplified by moving some instance setup to PropertyMetaclass __call__
    • By default __init__ now only sets kwargs (and fires change notifications)
  • Float, Integer, and Complex validation has been changed to be more leniant. In try/except, values are coerced then equality is checked. If both of those pass with no exceptions, the value is valid.
    • Notably, this allows numpy.float16 and other similar numpy classes that are not subclasses of float/int/complex to pass validation.
    • This does not apply for Bool - values here must be type bool to pass (eg. numpy.bool8 does not pass.
  • New task module for defining for implementing callable HasProperties Tasks
  • Array properties may now be of dtype bool in addition to int or float
  • Exception types:
    • Note: changing exception types may introduce backwards-incompatibility in error handling
    • No more AssertionErrors or KeyErrors are raised. Now properties raises three types of errors:
    • AttributeErrors on assignment to nonexistent properties/attributes
    • TypeErrors when Property attributes (e.g. required) are set to invalid values
    • ValueErrors when property values are invalid (i.e. validation on set fails)
  • Terms used to construct properties are now stored on the property for recreating a (possibly modified) version of the property. The terms attribute is an instance of a PropertyTerms namedtuple, which contains fields: name, cls, args, kwargs and meta.
  • StringChoice properties now allow sets as input. There is also additional validation to ensure no duplicates are present.
  • filter_props now has an option to exclude immutable properties
  • Minor improvements to doc strings and sphinx docs
    • Properties are now alphabetized in the docs (or the order can be customized by setting _doc_order to a list of the property names in the desired order).
  • Property attributes help and helpdoc were renamed doc to remove the name conflict with builtin help this change is not backwards compatible but it is unlikely these attributes are referenced externally anywhere.
  • Expanded testing
  • Video added to README

Bug Fixes

  • String properties now can handle unicode because casting to str was removed.
    • There is now a unicode attribute. If True (default) all strings are coerced to unicode; if False the input string type is maintained.
  • Property validators (observers that fire on set, before the change) may now coerce the value by modifying the change dictionary. Previously they were allowed to have a coerced return value, but this value was never used.
  • Array dtype validation previously allowed bad types to pass as long as 1+ good type was present. Now only good types (int, float, and bool) are allowed.

- Python
Published by fwkoch about 9 years ago

properties - v0.2.3 - New default behaviour, updated vectormath compatibility

Major Features

  • New default behaviour:
    • default values are validated but the underlying value is unchanged. This is mostly important when documenting (so, for example, if a Color property has a default value 'random', "random" shows up in the docs, rather than some coerced RGB triple).
    • startup() has been removed. This was used mainly to instantiate new instances in Instance properties and lists in List properties. Now, if a default value is callable, it is called when accessed.
    • _class_default is used much more sparingly. Basic properties (ie Integers and Bools) no longer have a class default (other than undefined). This is only used in List and Instance classes but may be defined in other Property subclasses.
    • Improved determination of default values from nested property classes like List and Union including warnings if unused defaults are defined.
  • Updated vectormath:
    • Now dependent on vectormath >= 0.1.0 (see release notes)
    • The separation of individual Vector classes vs. VectorArray classes is mirrored in properties
    • The old Vector2 and Vector3 are now Vector2Array and Vector3Array properties and individual vector properties named Vector2 and Vector3 have been introduced.

Minor Changes

  • required is now True by default - This assumes most properties you add to a HasProperties class are there for a reason.
  • _exclusive_kwargs has been removed from HasProperties in favour of separate filter_props util function
  • Immutable GettableProperties are now documented in sphinx as attributes rather than properties.
  • Extensive cleanup to allow pylint tests to pass
  • Minor improvements to README and docs

Bug Fixes

  • Class validator functions were not callable on their own; now they are.

- Python
Published by fwkoch over 9 years ago

properties - v0.2.2 - Sphinx AutoDoc; Improved List, Union, and Instance Properties

New Features

  • Sphinx documentation generated for HasProperties classes in the metaclass based on the class's properties

Minor Changes:

  • required properties may now have default values. On validate, a required property cannot be None or undefined
  • assert_valid ensures HasProperty classes are valid
  • List:
    • List properties are now lists of a given property type. A HasProperties class can also be provided - this is coerced into an instance property of that class.
    • validation errors raise list errors rather than errors of the property type
    • assert_valid validates HasProperties instances only
    • list now has min/max length property
  • Union:
    • Similar to list, Union now allows HasProperties classes, coercing them into Instance properties
    • Union was moved to base from basic
  • Uid:
    • assert_valid ensures the uid has not been tampered with
  • Additional testing of the new features
  • Improved docstrings

- Python
Published by fwkoch over 9 years ago

properties - v0.2.1 - Validators

New features: - @properties.validator wrapper for methods of HasProperties classes. - If this wrapper is used without arguments, the wrapped function becomes a ClassValidator that is called on has_props_instance.validate() - If this wrapper is given property name(s) like the @properties.observer wrapper, then the wrapped function is called on property change. validator functions are called before the change; observer functions are called after the change. - @properties.observe => @properties.observer rename to match validator

Minor changes: - choices is now required on StringChoices __init__ - this fixes problems with validation of default values (ie trying to set and validate default before the choices are set)

- Python
Published by rowanc1 over 9 years ago

properties - v0.2.0 - Clean API

This is almost a complete rewrite that is more inline with traitlets except that the class namespace is much cleaner. This is quite important as these classes are exposed to interactive use.

This version includes: - observers - class _REGISTRY for all subclasses - better defaults and validators

- Python
Published by rowanc1 over 9 years ago

properties - v0.1.5 - Bug Fixes

Bug Fixes

  • use tofile() instead of tobytes() to maintain numpy 1.7 compatibility
  • remove unused string format variable in array error
  • replace '3point Science, Inc' with '3point Science' in the documentation

- Python
Published by fwkoch over 9 years ago

properties - v0.1.4 - Bug fixes

Bug Fixes

  • Fix a bug where pre and post values are incorrect in _on_property_change when using +=
  • Remove equal_nan in properties.array.serialize so numpy requirement >= 1.7 is accurate
  • Improve error messaging in properties.vector

- Python
Published by fwkoch over 9 years ago

properties - v0.1.3 - Resolve Pointers, Dirty, and PEP8

Major Features

  • Pointer ptype may now be the string name of a property class.
    • This allows recursive pointers to compile
    • Once importing is complete properties.Pointer.resolve() resolves these string ptypes into PropertyClass ptypes
    • This release introduces and corrects for infinite loops during validation
  • PropertyClasses now contain a _dirty attribute
    • This lists the properties that have been changed
    • It recurses into pointers to determine if they are dirty as well
    • _on_property_change hook fires when properties are changed
    • _mark_clean makes all properties no longer dirty
  • Several non-backwards-compatible variable and method name changes for PEP8 compatibility
    • properties.vmath.Vector methods .as* with camelCase renamed to .as_* with no camel case
    • properties.basic.Range attributes maxValue and minValue renamed max_value and min_value
    • Other internal name changes are also included

Minor Features

  • Color may now be 'random'
  • Array properties may only have dtype float, int, or (float, int). None is no longer an option
  • 'auto_create' is now an attribute of properties
    • The default is True
    • However it can be set to False if an creating a default property class instance is unwanted (or cannot be done due to required initialization parameters)
  • 'repeated' properties can now be 'required' so one or more value is required
  • Improved properties.basic.Range and properties.basic.RangeInt
  • Broken and incomplete math classes (matrix, plane, and parallelogram) removed

- Python
Published by fwkoch over 9 years ago