orxtra v0.13.0 /tool.src.orxtra.tool._data_tool_loader
On this page

Loads and validates data-defined tool TOML files into DataToolDefinition via the strictspec-generated document gate, enforces the custom. namespace root, and validates {{secret:NAME}} references against the registry.

#tool.src.orxtra.tool._data_tool_loader

#tool.src.orxtra.tool._data_tool_loader

Loader for data-defined tool TOML definitions.

Parses .toml files, validates with the pydantic schema, enforces the custom. namespace root, and validates {{secret:NAME}} references against the secret registry.

#DataToolValidationError

A data-tool document failed strictspec validation at the load boundary.

#load_tool_definition

python
def load_tool_definition(path: Path, secret_registry: SecretRegistry | None=None) -> DataToolDefinition

Parse and validate a single data-defined tool TOML file.

Args:

  • path: Path to the .toml file.
  • secret_registry: When provided, all {{secret:NAME}}

references in the file are validated against the registry.

Returns:

  • A validated DataToolDefinition.

Raises:

  • FileNotFoundError: If the path does not exist.
  • ValueError: On validation failure (wraps pydantic errors).
  • KeyError: On unknown secret references.

#_validate_secrets

python
def _validate_secrets(definition: DataToolDefinition, path: Path, secret_registry: SecretRegistry) -> None

Scan all string fields in the definition for {{secret:NAME}} references and validate them against the registry.

Raises KeyError with a descriptive message on unknown references.

#load_tool_definitions

python
def load_tool_definitions(directory: Path, secret_registry: SecretRegistry | None=None) -> list[DataToolDefinition]

Load all data-defined tool TOML files from a directory.

Args:

  • directory: Path to the directory containing .toml files.
  • secret_registry: When provided, all secret references are

validated against the registry.

Returns:

  • A list of validated DataToolDefinition objects.

Raises:

  • FileNotFoundError: If the directory does not exist.
  • ValueError: On validation failure or name collision.
  • KeyError: On unknown secret references.
Search