Guide¶
Reference material about the API itself, as opposed to the task-oriented
Tutorials: what the pg.Object flags mean, how to
write subclasses that satisfy both runtime validation and static type-checkers,
and how the implementation performs.
Pages¶
- Semantics — the
pg.Objectsemantic spectrum. One class statement spans a flat, dataclass-equivalent object through a fully tree-aware value object, along the class-leveltopoaxis (refined byvalidate/eq/ mutability). Read this to decide where on the spectrum your class belongs. - Styles — conventions for writing
pg.Objectsubclasses: the three forms of field declaration, positional__init__,ClassVarfor configuration, container storage, and the field-default override pitfalls. The patterns come out of repeated friction with PEP 681'sdataclass_transformmodel, so they are not arbitrary. - Perf — measured
pg.Objectcost against@dataclassand pydantic v2 across ~50 operations, in both cores. Read ratios rather than absolutes; the numbers are machine-specific.
If you are new to PyGX, start with Learning PyGX for the concepts, or the bird's-eye view for a runnable tour.