Skip to content

Releases: 8451/labrea

v2.1.0

15 Apr 15:08
7094fca
Compare
Choose a tag to compare

Changelog

Version 2.1.0

  • Add many helper functions in labrea.functions:
    • partial
      • Analog of functools.partial
    • into
      • Analog of * unpacking but for an evaluatable that returns an iterable
    • ensure
      • Make an assertion before continuing to next step
    • get_attribute
      • Get attribute from an object
    • call_method
      • Call a method on an object
    • flatten
      • Flatten an interable of iterables
    • flatmap
      • Map then flatten result
    • map_items, map_keys, and map_values
      • Analogs of map but for mapping types
    • filter_items, filter_keys, and filter_values
      • Analogs of filter but for mapping types
    • concat, append
      • Add items to an interable
    • intersect, union, difference, symmetric_difference
      • Set operations
    • merge
      • Merge two dictionaries
    • get, get_from
      • Get a key from an indexable object
    • length
    • add, subtract, multiply, divide_by, left_multiply, divide_into, negate, modulo
      • Basic math operations
    • eg, ne, lt, le, gt, ge
      • Basic comparison operations
    • positive, negative, non_positive, non_negative
      • Common comparisons
    • is_none, is_not_none
      • Check if an object is None
    • has_remainder, even, odd
      • Checking modulo of a number
    • any, all
      • Check if multiple predicates hold
    • invert
      • Invert a boolean value
    • instance_of
      • Check if an object is an instance of a class
    • is_in, is_not_in, one_of, none_of, contains, does_not_contain, intersects, disjoint_from
      • Check if a value is another collection
  • Add optional type and domain arguments to the Option constructor
    • type is a type hint for the value of the option
      • By default, not enforced at runtime
      • An optional labrea-type-validation package is planned to enforce with pydantic
      • Can use Option[Type]("KEY") syntax instead
    • domain is one of
      • A container of valid values
      • A predicate function
      • An evaluatable that returns one of the above
  • Add @Option.namespace decorator for creating option namespaces
    • Also Option.auto helper method for creating options within a namespace
  • Add Option.set method for setting the value of an option in a dictionary
  • Add callback argument to @dataset decorator for providing a callback function to be called after the dataset is evaluated
    • This callback is inherited by all overloads of the dataset
  • Add the ability to stack the Dataset.overload decorator with the @dataset decorator
    • This allows for a nested overload tree to be defined
  • Add new TypeValidationRequest for validating types
    • Options will run this request when evaluated, but by default no handler is provided
  • Add request types for the core .evaluate, .validate, .keys, and .explain methods
    • By default these just call the class' implementation
    • Can be handled to provide custom behavior, such as mocking
  • Improved logging for the evaluation traceback
  • Modify PartialApplication type to work even if multiple arguments are missing
  • Allow dataset.where to be used with functions with **kwargs
  • Fix a bug that cause caching to be susceptible to hash collisions.

v2.0.4

16 Dec 14:34
2dfad5a
Compare
Choose a tag to compare

Changelog

  • Make the Overloaded type pickleable
    • By extension, this makes the Dataset type pickleable

v2.0.3

13 Nov 17:25
39d316a
Compare
Choose a tag to compare

Changelog

  • Fix bug where dispatch is called with empty options

v2.0.2

01 Nov 16:05
Compare
Choose a tag to compare

Changelog

  • Allow dataset to be used to directly wrap an evaluatable
  • Fix bug in Switch.keys that didn't properly handle when the dispatch by default will evaluate to something

v2.0.1

08 Aug 21:24
28b55f3
Compare
Choose a tag to compare

Changelog

  • Fix bug where pipeline steps are evaluated before their inputs

v2.0.0

05 Aug 13:17
Compare
Choose a tag to compare

Changelog

Full rewrite. Includes updating the Evaluatable type to be a proper monad with .apply and .bind methods for arbitrary transformation chaining, as well as breaking apart the key components of the Dataset type (function definition conversion, caching, overloads, effects) into composable pieces that can be used by third-party types.

See changelog

v1.4.0

28 May 18:08
Compare
Choose a tag to compare

Changelog

  • Release as open source