httk.core.entry_records

Declarative frozen records with explicit OPTIMADE property metadata.

Classes

EntryRecord

Common metadata for application-defined served records.

DataEntryRecord

Base for typed application records served at _httk_records.

Property

Declare a served scalar field through Annotated metadata.

Functions

entry_record(name)

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 type and definition_id and use entry_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
type: ClassVar[str]
definition_id: ClassVar[str]
classmethod entry_type_definition()

Return this concrete record’s extended entry-family definition.

Returns:

The base family definition extended with declared properties.

Raises:
Return type:

httk.core.property_definitions.EntryTypeDefinition

class httk.core.entry_records.DataEntryRecord

Bases: EntryRecord

Base for typed application records served at _httk_records.

No scientific fields are prescribed. This does not replace the existing DataRecord single-property value model.

type: ClassVar[str] = 'records'
definition_id: ClassVar[str] = 'https://schemas.httk.org/defs/v0.1/entrytypes/records'
class httk.core.entry_records.Property

Declare a served scalar field through Annotated metadata.

The Python annotation supplies the type (str, int, float, or bool, optionally nullable). Only marked fields become served attributes. Use an existing PropertyDefinition as 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>.

description: str
unit: str | None = None
name: str | None = None
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]]