Galaxy Tool Utility Models
raw JSON → 26.0.0 verified Mon Apr 27 auth: no python
Pydantic models for Galaxy tools, providing type-safe data structures for tool definitions, parameters, inputs, outputs, and workflows. Current version 26.0.0, part of the Galaxy project, released as part of the main Galaxy monorepo with no fixed cadence.
pip install galaxy-tool-util-models Common errors
error ModuleNotFoundError: No module named 'galaxy.tool_util' ↓
cause Package 'galaxy-tool-util-models' is not installed.
fix
Run: pip install galaxy-tool-util-models
error pydantic.error_wrappers.ValidationError: 1 validation error for Tool ↓
cause Provided dictionary does not match the model schema (e.g., missing required field or wrong type).
fix
Check the model fields and types. Use model.schema() to see expected schema. Ensure fields like 'id' and 'name' are present.
error AttributeError: 'Tool' object has no attribute 'workflow' ↓
cause Attempting to access a removed attribute; workflow fields were separated in v25.0.
fix
Access workflow-related data through the WorkflowStep model: from galaxy.tool_util.models import WorkflowStep
error ImportError: cannot import name 'Tool' from 'galaxy.tool_util' ↓
cause Wrong import path: trying to import from the package namespace, not the 'models' submodule.
fix
Use: from galaxy.tool_util.models import Tool
Warnings
breaking Import path change: models moved from 'galaxy.tools' to 'galaxy.tool_util.models' in v21.x. Old imports like 'from galaxy.tools import Tool' will fail. ↓
fix Use 'from galaxy.tool_util.models import Tool'.
breaking Removal of 'Tool.workflow' attribute. Workflow-specific fields are now in separate WorkflowStep models. ↓
fix Use 'WorkflowStep' model from the same module for workflow-related tool definitions.
gotcha Package name vs import path: install with 'galaxy-tool-util-models' but import from 'galaxy.tool_util.models'. New users often try 'import galaxy_tool_util_models' which fails. ↓
fix Correct import: 'from galaxy.tool_util.models import ...'
Imports
- Tool wrong
from galaxy_tool_util_models import Toolcorrectfrom galaxy.tool_util.models import Tool - ToolParameter wrong
from galaxy.tool_util.models.parameters import ToolParametercorrectfrom galaxy.tool_util.models import ToolParameter
Quickstart
from galaxy.tool_util.models import Tool, ToolParameter
# Example: parse a tool definition (assuming raw dict)
raw_tool = {
"id": "example_tool",
"name": "Example Tool",
"inputs": [
{
"name": "input_file",
"type": "data",
"optional": False
}
]
}
tool = Tool(**raw_tool)
print(tool.name)