Warning

This document is for an in-development version of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.tool_util.toolbox.lineages package

class galaxy.tool_util.toolbox.lineages.LineageMap(toolbox: AbstractToolBox)[source]

Bases: object

Map each unique tool id to a lineage object.

__init__(toolbox: AbstractToolBox)[source]
register(tool: Tool) ToolLineage[source]
get(tool_id: str) ToolLineage | None[source]

Get lineage for tool_id.

By preference the lineage for a version-agnostic tool_id is returned. Falls back to fetching the lineage only when this fails. This happens when the tool_id does not contain a version.

class galaxy.tool_util.toolbox.lineages.ToolLineage(tool_id: str)[source]

Bases: object

Simple tool’s loaded directly from file system with lineage determined solely by PEP 440 versioning scheme.

lineages_by_id: dict[str, ToolLineage] = {}
lock = <unlocked _thread.lock object>
__init__(tool_id: str) None[source]
property tool_ids: list[str]
classmethod from_tool(tool: Tool) ToolLineage[source]
register_version(tool_version: str) None[source]
classmethod reset() None[source]

Clear the global lineages_by_id cache.

lineages_by_id is a class attribute, so toolbox shutdown clears it before another boot reconstructs lineages from current metadata.

get_versions() list[ToolLineageVersion][source]

Return an ordered list of lineages (ToolLineageVersion) in this chain, from oldest to newest.

get_version_ids(reverse: bool = False) list[str][source]
to_dict() dict[str, Any][source]

Submodules

galaxy.tool_util.toolbox.lineages.factory module

class galaxy.tool_util.toolbox.lineages.factory.CachedLineageMap(toolbox: AbstractToolBox, versions_for: Callable[[str], Iterable[str]] | None = None)[source]

Bases: LineageMap

Lineage map that derives versions from a callable on first access.

Used by galaxy.tools.cached_toolbox.CachedToolBox so the lineage view over ToolIndex.entries_by_version doesn’t need a boot-time pass to seed every tool’s version set into ToolLineage.tool_versions. Lineage data is already serialised inside the index (ToolIndex.to_dict); this class just exposes it as a LineageMap on demand.

__init__(toolbox: AbstractToolBox, versions_for: Callable[[str], Iterable[str]] | None = None)[source]
get(tool_id: str) ToolLineage | None[source]

Get lineage for tool_id.

By preference the lineage for a version-agnostic tool_id is returned. Falls back to fetching the lineage only when this fails. This happens when the tool_id does not contain a version.

class galaxy.tool_util.toolbox.lineages.factory.LineageMap(toolbox: AbstractToolBox)[source]

Bases: object

Map each unique tool id to a lineage object.

__init__(toolbox: AbstractToolBox)[source]
register(tool: Tool) ToolLineage[source]
get(tool_id: str) ToolLineage | None[source]

Get lineage for tool_id.

By preference the lineage for a version-agnostic tool_id is returned. Falls back to fetching the lineage only when this fails. This happens when the tool_id does not contain a version.

galaxy.tool_util.toolbox.lineages.interface module

class galaxy.tool_util.toolbox.lineages.interface.ToolLineageVersion(id: str, version: str)[source]

Bases: object

Represents a single tool in a lineage. If lineage is based around GUIDs that somehow encode the version (either using GUID or a simple tool id and a version).

__init__(id: str, version: str) None[source]
property id_based: bool

Return True if the lineage is defined by GUIDs (in this case the indexer of the tools (i.e. the ToolBox) should ignore the tool_version (because it is encoded in the GUID and managed externally).

to_dict() dict[str, str][source]
class galaxy.tool_util.toolbox.lineages.interface.ToolLineage(tool_id: str)[source]

Bases: object

Simple tool’s loaded directly from file system with lineage determined solely by PEP 440 versioning scheme.

lineages_by_id: dict[str, ToolLineage] = {}
lock = <unlocked _thread.lock object>
__init__(tool_id: str) None[source]
property tool_ids: list[str]
classmethod from_tool(tool: Tool) ToolLineage[source]
register_version(tool_version: str) None[source]
classmethod reset() None[source]

Clear the global lineages_by_id cache.

lineages_by_id is a class attribute, so toolbox shutdown clears it before another boot reconstructs lineages from current metadata.

get_versions() list[ToolLineageVersion][source]

Return an ordered list of lineages (ToolLineageVersion) in this chain, from oldest to newest.

get_version_ids(reverse: bool = False) list[str][source]
to_dict() dict[str, Any][source]