Python objects you can mutate like JSON, then evolve
A Google Brain library that turns Python classes into symbolic, manipulable structures for AutoML and meta-programming.
What it does
PyGlove wraps Python classes with a @pg.symbolize decorator that makes objects mutable and inspectable after creation. You can rebind fields, iterate over variants, and treat running code as data structures. It bundles search algorithms and plugs into distributed infrastructure like Vizier.
The interesting bit
The pitch is “symbolic object-oriented programming” — the same object exists both as executable code and as a manipulable tree. The rebind and pg.oneof examples in the README look almost too simple, which is the point: drop search into existing code without rewriting it.
Key highlights
@pg.symbolizedecorator converts plain Python classes into symbolic, mutable objectsrebind()mutates object fields after instantiation;pg.oneof()/pg.iter()generate search variants- Built-in search algorithms (evolution, etc.) with API for custom ones
- Distributed search backend support, including Open Source Vizier integration
- NeurIPS 2020 publication; used internally at Google Research, Cloud, YouTube, Waymo
- Very few dependencies beyond Python itself
Caveats
- README examples are toy-level; real complexity lives in linked notebooks
- “General-purpose” claim is broad — actual sweet spot appears to be ML search spaces, not everyday Python glue
- Not an officially supported Google product
Verdict
Worth a look if you’re building AutoML pipelines or need to evolve Python program structures. Probably overkill if you just want configuration management or simple hyperparameter tuning.