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 Common errors
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.
Warnings
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.
Imports
- Task wrong
from pydantic_tes import Taskcorrectfrom pydantic_tes.models import Task - TesTask wrong
from pydantic_tes import TesTaskcorrectfrom pydantic_tes.models import TesTask
Quickstart
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))