torchcell.provenance.ContractSpec

class ContractSpec(bases: tuple[str, ...], fields: tuple[tuple[str, FieldSpec], ...], assigns: tuple[tuple[str, str], ...], methods: tuple[tuple[str, str], ...], config: str | None)[source]

Bases: object

The contract-relevant surface of one schema class.

Two classes with equal ContractSpec serialize/validate identically as far as this static analysis can tell, and get the same fingerprint. Docstrings, plain (non-validator) methods, comments, field descriptions and field ORDER are excluded by construction.

canonical() → str[source]

Deterministic, order-insensitive serialization used for the fingerprint.