schrodinger.application.models.transform_catalog.datamodels module

Data models for YAML transform catalog metadata.

class schrodinger.application.models.transform_catalog.datamodels.SettingSpec(*, name: str, type_repr: str, description: str | None = None, default: ~typing.Any = None, allowed_values: tuple[typing.Any, ...] | None = None, is_required: bool = False, constraints: dict[str, typing.Any] = <factory>)

Bases: BaseModel

Metadata for one configuration setting of a YAML transform.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
type_repr: str
description: str | None
default: Any
allowed_values: tuple[Any, ...] | None
is_required: bool
constraints: dict[str, Any]
property type: Any

Return the resolved Python annotation for this setting.

isValidValue(value: Any) → bool

Return whether this setting accepts value.

A text form of the value is accepted, since a model definition holds every setting as a string.

castValue(value: Any) → Any

Return value converted according to the catalog annotation.

findMissingPaths(value: Any) → list[tuple[pathlib.Path, str]]

Return the paths in value that must exist but do not.

Each pair is a path and the kind expected there, 'file' or 'directory'.

castPipelineValue(value: Any) → Any

Cast value to its pipeline-YAML-compatible data shape.

class schrodinger.application.models.transform_catalog.datamodels.TransformSpec(*, settings: tuple[SettingSpec, ...] = (), description: str | None = None, input_type: str | None = None, output_type: str | None = None)

Bases: BaseModel

Metadata for one @yaml_transform-decorated class.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

settings: tuple[SettingSpec, ...]
description: str | None
input_type: str | None
output_type: str | None
property settings_by_name: Mapping[str, SettingSpec]

Return this transform’s settings keyed by setting name.