httk.core.entry_records¶
Declarative frozen records with explicit OPTIMADE property metadata.
Classes¶
Common metadata for application-defined served records. |
|
Base for typed application records served at |
|
Declare a served scalar field through |
Functions¶
|
Declare a frozen served record with a stable, explicit identity. |
Module Contents¶
- class httk.core.entry_records.EntryRecord¶
Common metadata for application-defined served records.
Subclasses declare their entry family’s
typeanddefinition_idand useentry_record()to become concrete frozen records. Metadata fields are keyword-only and excluded from equality and content identity.- Parameters:
id – Public lineage identifier, assigned by the store when omitted.
immutable_id – Revision identifier, assigned by the store when omitted.
last_modified – Optional timezone-aware source modification time.
- Raises:
ValueError – If an identifier is empty or a timestamp lacks a timezone.
- id: Annotated[str | None, IdentitySkip(), Indexed()] = None¶
- immutable_id: Annotated[str | None, IdentitySkip(), Unique()] = None¶
- last_modified: Annotated[datetime.datetime | None, IdentitySkip()] = None¶
- classmethod entry_type_definition()¶
Return this concrete record’s extended entry-family definition.
- Returns:
The base family definition extended with declared properties.
- Raises:
TypeError – If the class was not decorated with
entry_record().ValueError – If a standard property definition is replaced.
- Return type:
- class httk.core.entry_records.DataEntryRecord¶
Bases:
EntryRecordBase for typed application records served at
_httk_records.No scientific fields are prescribed. This does not replace the existing
DataRecordsingle-property value model.
- class httk.core.entry_records.Property¶
Declare a served scalar field through
Annotatedmetadata.The Python annotation supplies the type (
str,int,float, orbool, optionally nullable). Only marked fields become served attributes. Use an existingPropertyDefinitionas the annotation metadata instead when a curated definition exists.- Parameters:
description – Scientific meaning of the field, including normalization.
unit – Property unit; omitted means dimensionless.
name – Served name; omitted uses
_httk_custom_<field>.
- httk.core.entry_records.entry_record[T](name)¶
Declare a frozen served record with a stable, explicit identity.
This decorator does not register global plugins. Pass the resulting class explicitly to the store on creation and reopening. Referenced records remain ordinary dataclass fields. Property mappings are compiled for each concrete class; subclasses must opt in with their own decoration and identity.
- Parameters:
name (str) – Stable logical identity, independent of the Python module/name.
- Returns:
A decorator that creates a frozen dataclass and its served mappings.
- Raises:
TypeError – If the class, field type, or declaration is unsupported.
ValueError – If identities, property names, or definitions conflict.
- Return type:
collections.abc.Callable[[type[T]], type[T]]