Pydantic TES

raw JSON →
0.4.0 verified Mon Apr 27 auth: no python

Pydantic models for the GA4GH Task Execution Service (TES) API. Version 0.4.0. Release cadence is irregular.

pip install pydantic-tes
error ImportError: cannot import name 'Task' from 'pydantic_tes'
cause Top-level import path changed in 0.4.0.
fix
Use from pydantic_tes.models import Task
error pydantic.errors.PydanticUserError: Field name 'foo' is not defined in model Task
cause Extra field provided in dict to model constructor.
fix
Remove extra fields or set model_config = ConfigDict(extra='allow') on your model subclass.
breaking In 0.4.0, model subpackage structure changed; direct imports from top-level may break.
fix Use `from pydantic_tes.models import ...` instead of `from pydantic_tes import ...`.
deprecated Some model aliases (e.g., TesTask, TesInput) may be deprecated in favor of simpler names (Task, Input).
fix Prefer the shorter names (Task, Input, etc.) from pydantic_tes.models.
gotcha Field validation is strict; providing extra fields not defined in the model will raise ValidationError.
fix Ensure only fields defined by the model are used, or use model_config for extra fields handling.

Create a simple TES Task model instance.

from pydantic_tes.models import Task, TesResources, TesExecutor
from pydantic import BaseModel

# Create a minimal task
task = Task(
    id=None,
    executors=[TesExecutor(command=["echo", "hello"])],
    resources=TesResources(cpu_cores=1, ram_gb=1, disk_gb=10)
)
print(task.json(indent=2))