Skip to content

Releases: google/pyglove

PyGlove v0.4.4

04 Jan 19:14
Compare
Choose a tag to compare

This release contains refinements of object behaviors, including typing, formatting, serialization, hashing and etc. Besides, it introduces pg.io as an abstracted interface for operating with different file systems.

New Sub-packages

Enhancements

  • Typing

  • Object Formatting:

    • Introduce __str_format_args__ and __repr_format_args__ attributes for customize str/repr behavior for pg.Formattable. (7e0a98b)
    • Introduced pg.str_format and pg.repr_format context manager to control repr/str formatting for symbolic objects. (0a2ea6)
    • Add argument markdown for pg.str_format and pg.repr_format to quote the formatted object. (fd6ea8d)
    • Added argument use_inferred for pg.Symbolic formatting. (fdd3d3d)
    • Escape strings with ' and \n in pg.format. (0489642)
    • Better formatting for field docstr of multiple lines. (900d677)
  • Object Serialization:

    • Support module alias for deserialization. (536bde1)
    • Support use_inferred flag for pg.to_json and pg.save. (e223f6d)
  • Object Behaviors:

    • pg.List.__iter__ to honor inferrable values. (a4dacb5)
    • Enabled symbolic comparison/hashing on Python functions and methods. (occc11b)
    • Tune pg.Symbolic.set_accessor_writable behavior to only affect current node instead the entire sub-tree. (ee6009b)

Bug Fixes

  • pg.symbolic
    • Fix pg.Dict.sym_hash behavior for child symbolic objects whose use_symbolic_comparison is False. (58b60c3)
    • Fix the default value inspection for pg.Symbolic.sym_nondefaults and pg.format. (121b5ef)

PyGlove v0.4.3

13 Sep 23:14
Compare
Choose a tag to compare

This release contains major updates on pg.symbolic and pg.typing.

Enhancements

  • pg.symbolic

    • (Major)pg.to_json/pg.from_json: supported serialization of Python types, annotations, functions/methods and opaque objects (6529a3c, 7777e8f, 4911073)
    • (Major) Added pg.Inferential for symbolic value inference (5ef667c).
    • (Major) Added symbolic reference pg.Ref, which allows referencing symbolic values in a symbolic tree (b28dc68).
    • pg.Functor: supported functor creation through subclasssing (4950819).
    • pg.Symbolic.rebind: supported notify_parents flag (cd0029c).
    • pg.symbolic.Origin: added root property and history method (2686b29).
    • pg.Symbolic.sym_*: have consistent value for default (90afe73).
  • pg.typing

    • (Major) pg.typing.ValueSpec can be used as a drop-in replacement for standard Python annotations. E.g. pg.typing.List[int] (ddbade7, c2eca16, 79ec73).
    • (Major) pg.Schema, pg.typing.Field and pg.typing.KeySpec and pg.typing.ValueSpec are now serializable (7777e8f).
    • Added pg.typing.Annotated, pg.typing.Sequence and pg.typing.Optional (ddbade7).
    • Added pg.typing.ValueSpec.transform for transforming the user input values during apply (a83c2ee, 0a9b034).
    • Added pg.typing.callable_eq for comparing two callable objects (7777e8f).
    • Added implicit conversion from int to float (caa3c93)
  • pg.object_utils

    • pg.format: supported include_keys argument (6703406).
    • pg.object_utils.thread_local_value_scope: fixed an unexpected behavior when all items in the stack are poped up (a560ff7).
    • Added pg.catch_errors context manager (a438fc0).

Bug Fixes

  • pg.symbolic

    • pg.Object.from_json: propagate allow_partial flag to child. (1cc5aab)
  • pg.typing

    • pg.typing.ForwardRef: fixed issue during deep copying (ddbade7).
  • pg.ext.early_stopping

    • Fix an issue in state recovery for pg.early_stopping.StepWise (808ca8e).

Deprecated/Renamed APIs

  • pg.symbolic

    • Renamed pg.Object.schema to pg.Object.__schema__, pg.Object.type_name to pg.Object.__type_name__, pg.Object.serialization_key to pg.JSONConvertible.__serialization_key__ (bdffd58)
    • Renamed pg.Functor.signature to pg.Functor.__signature__.
    • Removed pg.ContextualValue, pg.symbolic.GetAttributeContext, pg.Symbolic.sym_contextual_getattr/hasattr (5ef667c).
  • pg.typing

    • Merged pg.typing.get_first_applicable_converter into pg.typing.get_converter (dd1c253).

PyGlove v0.4.2

28 Jul 17:52
Compare
Choose a tag to compare

Enhancements

  • pg.symbolic
    • Overriding pg.Object.__init__ now requires to apply a @pg.explicit_method_override, which prevents users from accidentally override common Python methods that are managed PyGlove. (870ed11)
    • pg.compound now supports generic types as the base class .(4f659ab)
    • pg.compound also could use abstract class as the base class for Python 3.10 and above. (c206676)
    • pg.compound allow contextual attribute access from the decomposed object. (c206676)

PyGlove v0.4.1

22 Jul 03:53
Compare
Choose a tag to compare

This is a light release with a few enhancements/bug fixes for pg.typing and pg.symbolic.

Enhancements

  • pg.typing

    • pg.typing.Object,pg.typing.Type and type converters support Generic annotations. (4eabef3)
    • pg.Object now supports Callable[<input-type>, <output-type>] and Dict[str, <value-type>] annotations. (ab4a850)
  • pg.symbolic

    • Introducing pg.use_init_args for reordering the init arguments for the subclasses of pg.Object. (627990e)

Bug Fixes:

  • pg.typing

    • Tuple[<elem_type>, ...] now can be correctly recognized. (9e2a772)
  • pg.symbolic

    • pg.eq and pg.ne will no longer evaluate contextual value during member comparisons. (77a4bb1)
    • pg.diff(x, y, mode='diff') will return pg.Diff(left=pg.Diff.MISSING, right=pg.Diff.MISSING) when x == y, whose string representation is 'No diff'. (e31fa99)

PyGlove v0.4.0

13 Jul 17:09
Compare
Choose a tag to compare

New Features

Enhancements

  • pg.symbolic

    • Major: Introduce symbolic member declaration via field annotations, which replaces pg.members as the recommended way for symbolic field declaration (27a7392, 564cb1b)

    • Major: Introduce auto_typing for pg.symbolize and pg.functor. (5b57191)

    • Introduce context manager pg.auto_call_functors, which allows functor invocation right after init. This makes functors compatible with regular functions. (a00e787)

    • Introduce auto_doc argument for pg.symbolze. (e8b2520)

    • Support python_format argument for pg.Symbolic.format. (c3005c06)

    • pg.Object to allow member methods to work as the default value for callable symbolic attributes. (9b2bd3b)

    • Add pg.Object._begin_annotation_inference and pg.Object._end_annotation_inference as events for intercepting annotation inference during class creation. (af410fe)

  • pg.typing

    • Major: pg.typing.Object to support forward declaration. (9235f55)
  • pg.object_utils

    • Introduce pg.object_utils.thread_local_xxx APIs for thread local state managements. (4ee6572, e6a9066)

Bug Fixes

  • pg.typing

    • Fill pg.typing.Signature.return_value when the return annotation is not present. (3fe60e0)
    • Fix pg.ValueSpec.from_annotation on union type. (27a7392)
  • pg.symbolic

    • Improve init_arg_list inference: subclasses with new fields should not inherit base class' init_arg_list. (25e4c23)
    • Fix sym_parent None check. (48f23c8)
  • pg.ext.evolution

    • Fix pg.evolution.mutators.Uniform for misaligned subchoice DNASpec after sorting the subchoices. (c4ad652)
  • pg.ext.early_stopping

    • Fix gating index matching logic in pg.early_stopping.StepWise. (a5e0532)

Code Improvement

  • pg.symbolic
    • Revise pg.Object symbolic fields default value setting logic. (e64d516)
    • Revise schema and signature inference for pg.Object, pg.Functor and pg.ClassWrapper. (8141116)

Removed APIs

  • Removed pg.generators namespace. (ac40ae5)

Examples

PyGlove v0.3.0

17 Mar 21:34
Compare
Choose a tag to compare

New Features

  • Introducing extension module pg.mutfun for evolving low-level functions. (c67a1e7, 3c6cd7f, ba937c0)

  • Add pg.registered_types for accessing all registered JSONConvertible sub-classes. (c67a1e7)

Enhancements

pg.Symbolic:

  • Added property sym_root. (528aefc)
  • Added methods sym_ancestor and sym_descendants. (40bc014)

pg.sample:

  • Sampling of abstract search spaces (pg.DNASpec) is now supported (87707c2)

Module pg.typing:

  • PyType annotation could be used as value spec in pg.members/pg.symbolize. (e95505d)

Module pg.object_utils:

  • Pushed up shared JSONConvertible features to pg.object_utils module. (55bc482)

API changes.

  • Removed pg.schema (an alias for pg.members). (e25dbd9)

PyGlove 0.2.1

18 Jan 17:26
Compare
Choose a tag to compare
  • Highlights:

  • API changes

    • Removes non-DNA generators symbols from pg.generators sub-module. (4605a97)
    • Simplifies tuning backend interface by merging pg.tuning.BackendFactory into pg.tuning.Backend. (7e56bb7)
    • Renames pg.patching.object_factory to pg.patching.ObjectFactory. (2d65a16)
  • Enhancement

    • Supports pg.random_dna and pg.iter for pg.hyper.CustomHper. (49fc46a)
  • Bug fixes

    • pg.evolution.Evolution: Excludes infeasible trials from initial population during recovery. (d55f1dc)
  • New features

    • Introduces symbolic comparison: pg.lt and pg.gt. (747d6a)
    • Introduces pg.evolve for evolving arbitrary symbolic objects. (f2606eb)

PyGlove 0.2.0

13 Oct 18:23
Compare
Choose a tag to compare

Enhancements:

  • pg.symbolic:
    • Introducing pg.Symbolic.sym_has and pg.Symbolic.sym_get to test/get node in sub-tree by path.
    • Introducing pg.Symbolic.sym_field and pg.Symbolic.sym_attr_field to access the pg.typing.Field definition for current/child symbolic value.
    • pg.Symbolic.sym_getattr now supports default value.
    • pg.Symbolic.rebind now supports pg.KeyPath objects as keys.

Bug fixes:

  • pg.tuning: Fix pg.tuning.Feedback.should_stop_early crash on in-memory tuning backend.

New features:

  • (experimental) Introducing pg.composing to handle algorithmic symbolic mutations.

PyGlove 0.1.1

10 Oct 17:29
Compare
Choose a tag to compare
  • New Features

    • Introduce pg.logging to allow pluggable PyGlove logging.
    • Introduce pg.early_stopping with initial step-wise policies.
  • Enhancements

    • pg.hyper:

      • Support nested pg.hyper.DynamicEvaluationContext for supporting divide-and-conquer a search space.
      • Support scale type for pg.floatv.
      • Preserve numeric literal values when calling pg.hyper.Choices.dna_spec.
    • pg.tuning:

      • Support using base error class and error regex in pg.tuning.Feedback.skip_on_exceptions.
      • Add pg.tuning.Feedback.ignore_race_conditions to better handle race conditions from multiple co-workers
    • pg.evolution:

      • Make pg.evolution.Evolution thread-safe during propose/feedback.
      • Make pg.evolution.Evolution better report population initialization errors.