PyGlove is a general-purpose Python library for manipulating Python objects, introducing symbolic object-oriented programming (SOOP). It facilitates meta-program writing and is used in complex machine learning scenarios like AutoML, evolutionary computing, and daily programming tasks by providing a mutable symbolic object model and a rich set of object manipulation operations. It is currently at version 0.4.5 and actively maintained with regular updates.
pip install pygloveVerified import paths — ran on the pinned version, not inferred.
Define a symbolic class using `@pg.symbolize` and instantiate it. The object can then be used like a regular Python object.
Add the `@pg.explicit_method_override` decorator to any overridden `__init__` method in `pg.Object` subclasses.
Update usage to the new private API names (e.g., `__schema__`) or avoid direct use of removed internal components. Refer to release notes for precise renamings.
Carefully review PyGlove's documentation on symbolic object-oriented programming (SOOP) and mutation. Be prepared for potential refactoring and validation efforts when integrating with complex or highly customized object hierarchies.
Migrate from `pg.members` or `pg.schema` to using Python type annotations (e.g., `field_name: pg.typing.Int()` or `field_name: int = pg.symbolic.Field(...)`) for declaring symbolic fields within `@pg.symbolize`d classes.
Ensure the attribute name is correct and has been properly defined or initialized on the symbolic object. For attributes inferred from a symbolic parent chain (e.g., in a `pg.symbolize`d class), verify the attribute exists in an ancestor or the current context.
Install PyGlove using pip: `pip install pyglove`
Check the `pg.typing` schema defined for the symbolic object's attribute and ensure the value being assigned matches the expected type (e.g., `pg.typing.Int`, `pg.typing.Float`, `pg.typing.Str`, etc.).
Verify that the key you are trying to access exists in the symbolic dictionary or object. Use methods like `.get()` with a default value, or check for key existence using the `in` operator before access to prevent the error.
No dependency data recorded yet.