Releases: google/pyglove
PyGlove v0.4.5
This stable-version release includes major updates and enhancements/bug fixes since Jan 2024.
Major updates
-
Python 3.13 support (d655ea0)
-
Introduce
pg.viewsmodule: PyGlove's view sub-system for rendering objects. (b7e1e83) -
Introduce
pg.codingmodule: Utilities for code generation. (a4e5373)- Source code evaluation with permission control. (23ca0c2)
Enhancements
-
New features
-
Object typing
- Support JSON schema conversion through
pg.typing.ValueSpec.to_json_schema. (9018f25) - Support
__future__.annotations. (97d6446, 65c7e52) - Support
Protocolsubclasses. (50d8a38) - Support
ClassVar,Finalandpg.Ref[Type]annotations. (005ec58) - Allow override abstract property through symbolic attribute. (f7390c1)
- Enum fields could extend int/str fields. (aac846b)
pg.typing.Unionpreserves the order of candidates. (590584d)- Enables auto_typing for
pg.patcher. (7b56371) - Frozen fields will be absent from init signature. (e6810a8)
- Better forward reference handling. (a040480)
- Support JSON schema conversion through
-
Object serialization
- Add
pg.open_jsonlandpg.io.open_sequenceAPI for serializing/deserializing sequence data. (825db90) - Add
pg.JSONConvertible.load_types_for_deserializationto allow type override during deserialization. (a600470) - Allow
pg.Refto be serialized. (016992e) pg.from_jsonto supportauto_importargument. (c8431bf)pg.to_jsonto supportforce_dictargument. (328c956)
- Add
-
Object formatting
pg.formatto support recursive structures. (29591ea)pg.Formattable.__str_kwargs__and__repr_kwargs__to control default format arguments. (d5dd3c6)- Frozen fields will not be present during formatting. (e6810a8)
pg.Object.formatto control str/bytes field length viamax_str_lenandmax_bytes_len. ((5b9fba4)[https://github.com/google/pyglove/commit/5b9fba467e9f582e6110dce74a08cfc510290206])pg.formatto supportcustom_formatargument. (a78a78e)pg.Formattableto control whether to applymarkdownquotes. (c97818d)
-
Object reference
- Add
pg.derefto dereference a symbolic tree. ((120e924)[https://github.com/google/pyglove/commit/120e924aaad461b766aff0bf65702c3c1fd9776e])
- Add
-
Object mutations
pg.evolveto support mutations on root element. (cc456b1)
-
Utilities
Bug fixes
- Fix serialization of
pg.Objectwith child dict of non-standard keys. (0adebc9) pg.Object: Inherit symbolic attributes from base even when it's overridden as properties. (aad25de)pg.typing.ForwardRefno longer cache resolved class, which allows module reloading. (a92e69e)
API changes
PyGlove v0.4.4
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 forpg.Formattable. (7e0a98b) - Introduced
pg.str_formatandpg.repr_formatcontext manager to control repr/str formatting for symbolic objects. (0a2ea6) - Add argument
markdownforpg.str_formatandpg.repr_formatto quote the formatted object. (fd6ea8d) - Added argument
use_inferredforpg.Symbolicformatting. (fdd3d3d) - Escape strings with
'and\ninpg.format. (0489642) - Better formatting for field docstr of multiple lines. (900d677)
- Introduce
-
Object Serialization:
-
Object Behaviors:
Bug Fixes
PyGlove v0.4.3
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.Inferentialfor 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: supportednotify_parentsflag (cd0029c).pg.symbolic.Origin: addedrootproperty andhistorymethod (2686b29).pg.Symbolic.sym_*: have consistent value fordefault(90afe73).
- (Major)
-
pg.typing- (Major)
pg.typing.ValueSpeccan 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.Fieldandpg.typing.KeySpecandpg.typing.ValueSpecare now serializable (7777e8f). - Added
pg.typing.Annotated,pg.typing.Sequenceandpg.typing.Optional(ddbade7). - Added
pg.typing.ValueSpec.transformfor transforming the user input values during apply (a83c2ee, 0a9b034). - Added
pg.typing.callable_eqfor comparing two callable objects (7777e8f). - Added implicit conversion from
inttofloat(caa3c93)
- (Major)
-
pg.object_utils
Bug Fixes
-
pg.symbolicpg.Object.from_json: propagateallow_partialflag to child. (1cc5aab)
-
pg.typingpg.typing.ForwardRef: fixed issue during deep copying (ddbade7).
-
pg.ext.early_stopping- Fix an issue in state recovery for
pg.early_stopping.StepWise(808ca8e).
- Fix an issue in state recovery for
Deprecated/Renamed APIs
-
pg.symbolic- Renamed
pg.Object.schematopg.Object.__schema__,pg.Object.type_nametopg.Object.__type_name__,pg.Object.serialization_keytopg.JSONConvertible.__serialization_key__(bdffd58) - Renamed
pg.Functor.signaturetopg.Functor.__signature__. - Removed
pg.ContextualValue,pg.symbolic.GetAttributeContext,pg.Symbolic.sym_contextual_getattr/hasattr(5ef667c).
- Renamed
-
pg.typing- Merged
pg.typing.get_first_applicable_converterintopg.typing.get_converter(dd1c253).
- Merged
PyGlove v0.4.2
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.compoundnow supports generic types as the base class .(4f659ab)pg.compoundalso could use abstract class as the base class for Python 3.10 and above. (c206676)pg.compoundallow contextual attribute access from the decomposed object. (c206676)
- Overriding
PyGlove v0.4.1
This is a light release with a few enhancements/bug fixes for pg.typing and pg.symbolic.
Enhancements
-
pg.typing -
pg.symbolic- Introducing
pg.use_init_argsfor reordering the init arguments for the subclasses ofpg.Object. (627990e)
- Introducing
Bug Fixes:
-
pg.typingTuple[<elem_type>, ...]now can be correctly recognized. (9e2a772)
-
pg.symbolic
PyGlove v0.4.0
New Features
-
pg.symbolic -
pg.object_utils- Introduce
pg.docstrfor DocStr inspection. ([29f02ad](https://github.com/google/pyglove/commit/
29f02ad))
- Introduce
-
pg.mutfun
Enhancements
-
pg.symbolic-
Major: Introduce symbolic member declaration via field annotations, which replaces
pg.membersas the recommended way for symbolic field declaration (27a7392, 564cb1b) -
Major: Introduce
auto_typingforpg.symbolizeandpg.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_docargument forpg.symbolze. (e8b2520) -
Support
python_formatargument forpg.Symbolic.format. (c3005c06) -
pg.Objectto allow member methods to work as the default value for callable symbolic attributes. (9b2bd3b) -
Add
pg.Object._begin_annotation_inferenceandpg.Object._end_annotation_inferenceas events for intercepting annotation inference during class creation. (af410fe)
-
-
pg.typing- Major:
pg.typing.Objectto support forward declaration. (9235f55)
- Major:
-
pg.object_utils
Bug Fixes
-
pg.typing -
pg.symbolic -
pg.ext.evolution- Fix
pg.evolution.mutators.Uniformfor misaligned subchoice DNASpec after sorting the subchoices. (c4ad652)
- Fix
-
pg.ext.early_stopping- Fix gating index matching logic in
pg.early_stopping.StepWise. (a5e0532)
- Fix gating index matching logic in
Code Improvement
pg.symbolic
Removed APIs
- Removed
pg.generatorsnamespace. (ac40ae5)
Examples
PyGlove v0.3.0
New Features
-
Introducing extension module
pg.mutfunfor evolving low-level functions. (c67a1e7, 3c6cd7f, ba937c0) -
Add
pg.registered_typesfor accessing all registeredJSONConvertiblesub-classes. (c67a1e7)
Enhancements
pg.Symbolic:
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
JSONConvertiblefeatures topg.object_utilsmodule. (55bc482)
API changes.
- Removed
pg.schema(an alias forpg.members). (e25dbd9)
PyGlove 0.2.1
PyGlove 0.2.0
Enhancements:
pg.symbolic:- Introducing
pg.Symbolic.sym_hasandpg.Symbolic.sym_getto test/get node in sub-tree by path. - Introducing
pg.Symbolic.sym_fieldandpg.Symbolic.sym_attr_fieldto access thepg.typing.Fielddefinition for current/child symbolic value. pg.Symbolic.sym_getattrnow supports default value.pg.Symbolic.rebindnow supportspg.KeyPathobjects as keys.
- Introducing
Bug fixes:
pg.tuning: Fixpg.tuning.Feedback.should_stop_earlycrash on in-memory tuning backend.
New features:
- (experimental) Introducing
pg.composingto handle algorithmic symbolic mutations.
PyGlove 0.1.1
-
New Features
- Introduce
pg.loggingto allow pluggable PyGlove logging. - Introduce
pg.early_stoppingwith initial step-wise policies.
- Introduce
-
Enhancements
-
pg.hyper:- Support nested
pg.hyper.DynamicEvaluationContextfor supporting divide-and-conquer a search space. - Support scale type for
pg.floatv. - Preserve numeric literal values when calling
pg.hyper.Choices.dna_spec.
- Support nested
-
pg.tuning:- Support using base error class and error regex in
pg.tuning.Feedback.skip_on_exceptions. - Add
pg.tuning.Feedback.ignore_race_conditionsto better handle race conditions from multiple co-workers
- Support using base error class and error regex in
-
pg.evolution:- Make
pg.evolution.Evolutionthread-safe duringpropose/feedback. - Make
pg.evolution.Evolutionbetter report population initialization errors.
- Make
-