{"id":6798,"library":"pyglove","title":"PyGlove","description":"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.","status":"active","version":"0.4.5","language":"python","source_language":"en","source_url":"https://github.com/google/pyglove","tags":["python","object-manipulation","symbolic-programming","automl","machine-learning","hyperparameter-tuning","evolutionary-computing"],"install":[{"cmd":"pip install pyglove","lang":"bash","label":"Install PyGlove"}],"dependencies":[],"imports":[{"symbol":"pyglove","correct":"import pyglove as pg"}],"quickstart":{"code":"import pyglove as pg\n\n@pg.symbolize\nclass Hello:\n  def __init__(self, subject):\n    self._greeting = f'Hello, {subject}!'\n\n  def greet(self):\n    print(self._greeting)\n\nhello = Hello('World')\nhello.greet()","lang":"python","description":"Define a symbolic class using `@pg.symbolize` and instantiate it. The object can then be used like a regular Python object."},"warnings":[{"fix":"Add the `@pg.explicit_method_override` decorator to any overridden `__init__` method in `pg.Object` subclasses.","message":"When overriding `pg.Object.__init__`, it is now mandatory to apply the `@pg.explicit_method_override` decorator. Failing to do so will result in an error, as it prevents accidental overrides of core PyGlove-managed methods.","severity":"breaking","affected_versions":">=0.4.2"},{"fix":"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.","message":"Several internal APIs were renamed. `pg.Object.schema` became `pg.Object.__schema__`, `pg.Object.type_name` became `pg.Object.__type_name__`, and `pg.Object.serialization_key` moved to `pg.JSONConvertible.__serialization_key__`. Similarly, `pg.Functor.signature` was renamed to `pg.Functor.__signature__`. Additionally, `pg.ContextualValue`, `pg.symbolic.GetAttributeContext`, and related methods were removed.","severity":"deprecated","affected_versions":">=0.3.0 (specific changes vary)"},{"fix":"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.","message":"PyGlove operates on a mutable programming paradigm, which can introduce complexities and limitations, especially when refactoring existing code. Adapting models and trainers to conform to PyGlove's symbolic object constraints, particularly for generic subclassed models, can be more challenging than expected, as symbolic nodes constructed by initialization parameters might not behave as anticipated.","severity":"gotcha","affected_versions":"All versions"},{"fix":"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.","message":"The `pg.members` function and its alias `pg.schema` were replaced by symbolic member declaration using field annotations as the recommended approach for defining symbolic fields within classes.","severity":"deprecated","affected_versions":">=0.3.0"}],"env_vars":null,"search_vec":"'0.4.5':63 'activ':65 'automl':36,77 'complex':31 'comput':38,86 'current':60 'daili':40 'evolutionari':37,85 'evolutionary-comput':84 'facilit':22 'general':6 'general-purpos':5 'hyperparamet':82 'hyperparameter-tun':81 'introduc':14 'learn':33,80 'librari':9 'like':35 'machin':32,79 'machine-learn':78 'maintain':66 'manipul':11,56,73 'meta':24 'meta-program':23 'model':49 'mutabl':46 'object':13,17,48,55,72 'object-manipul':71 'object-ori':16 'oper':57 'orient':18 'program':19,25,41,76 'provid':44 'purpos':7 'pyglov':1,2 'python':8,12,70 'regular':68 'rich':52 'scenario':34 'set':53 'soop':20 'symbol':15,47,75 'symbolic-program':74 'task':42 'tune':83 'updat':69 'use':29 'version':62 'write':26","created_at":"2026-04-15T18:43:26.636122+00:00","updated_at":"2026-04-16T18:28:21.114879+00:00","problems":[{"fix":"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.","cause":"This error occurs when attempting to access an attribute on a PyGlove symbolic object that does not exist or is not accessible within its symbolic context, often due to a typo, uninitialized attribute, or incorrect path in symbolic operations.","error":"AttributeError: '...Object' object has no attribute '...'"},{"fix":"Install PyGlove using pip: `pip install pyglove`","cause":"The PyGlove library is not installed in the current Python environment or the environment's Python path does not include the installation location.","error":"ModuleNotFoundError: No module named 'pyglove'"},{"fix":"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.).","cause":"This error often arises in PyGlove when a value assigned to a symbolic object's attribute does not conform to the predefined type specification (schema) for that attribute, which PyGlove's runtime typing system validates.","error":"TypeError: ..."},{"fix":"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.","cause":"This occurs when trying to access an item in a PyGlove symbolic dictionary or a property of a symbolic object using a key that does not exist.","error":"KeyError: '...'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"0.4.5","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/google/pyglove","docs":null,"changelog":null,"pypi":"https://pypi.org/project/pyglove/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}