galaxy-tool-source
A Python library and small CLI for parsing, profile-aware validation, and typed
inspection of Galaxy tool definition XML — the
<tool> wrapper files that define Galaxy bioinformatics tools.
This package is the foundation for a separate, black-like program for
Galaxy tool XML (conformance checking, autofixing, reformatting). It provides
only the foundation — no rules, no formatter, no serializer:
- Parse tool XML into a mutable representation that faithfully preserves CDATA, comments, attribute data and order, and significant element text.
- A typed read-only view of a parsed tool — bound to the model for the tool's own schema profile — for convenient rule-checking.
- Profile-aware XSD validation, with configurable macro handling so validation is accurate on real-world tools that use Galaxy macros.
- Near-miss typo suggestions against the schema vocabulary (suggest only).
Install
From PyPI:
pip install galaxy-tool-source
For development, from the workspace root:
uv sync
Usage
from galaxy_tool_source.binding import load_tool, validate_tool
document = load_tool("my_tool.xml")
print(document.profile)
result = validate_tool("my_tool.xml")
if not result.valid:
for error in result.errors:
print(error)
From the command line:
uv run galaxy-tool-source validate my_tool.xml
uv run galaxy-tool-source suggest my_tool.xml
uv run galaxy-tool-source profiles
Public API
The downstream formatter project may rely on exactly these symbols. Everything else is private and may change without notice.
from galaxy_tool_source.binding import load_tool, parse_tool, validate_tool, newest_valid_profile, oldest_valid_profile
from galaxy_tool_source.binding import load_macros
from galaxy_tool_source.binding import ParseResult, ValidationResult, XmlError, ToolXmlSyntaxError
from galaxy_tool_source.document import ToolDocument, MacroDocument
from galaxy_tool_source.macros import MacroError, imported_macro_paths, token_definitions, TokenDefinition, expanded_detection_root, top_level_expand_tags
from galaxy_tool_source.corrections import suggest_corrections, Correction
from galaxy_tool_source.boolean_values import suggest_boolean_normalizations, normalize_boolean_token, BooleanNormalization
from galaxy_tool_source.cheetah_refs import tool_cheetah_references, CheetahRef
from galaxy_tool_source.command_conditionals import command_boolean_conditionals, BooleanConditional
from galaxy_tool_source.cheetah_rename import rename_param, rename_param_plan, RenameOutcome, RenameEdit, RenamePlan
from galaxy_tool_source.bundle import ToolBundle, load_bundle, rename_param_in_bundle, BundleRenameOutcome
from galaxy_tool_source.version_tokens import tokenization_skip_reason, expansion_equality_holds, adopt_suffix_skip_reason, adopt_suffix_equality_holds, GALAXY_SUFFIX_VERSION, package_requirements, retarget_version, append_version_tokens, build_version_macros_root, tokenize_tree, tokenize_version_plan, VersionTokenPlan, VersionEdit, NewMacroFile, current_suffix, bump_suffix_skip_reason, bump_suffix_tree, SuffixSite, SuffixSiteKind
from galaxy_tool_source.profiles import available_profiles, latest_profile, UnknownProfileError
from galaxy_tool_source.schema_content import text_bearing_tags
from galaxy_tool_source.models.registry import model_module, tool_class
from galaxy_tool_source.models.any_tool import AnyTool
Architecture
ToolDocument (document.py) wraps a mutable lxml tree — the source of truth,
faithfully preserving CDATA, comments, and attribute order. binding.py parses
and validates; profiles.py resolves the per-release vendored XSD; macros.py
handles Galaxy macros (the sole galaxy-util adapter); corrections.py suggests
near-miss typo fixes; boolean_values.py reports schema-boolean attribute value
normalizations (True → true); cheetah_refs.py / cheetah_rename.py find and
rename a parameter across a tool's Cheetah sections (the latter renders the rename
either as a tree mutation, rename_param, or as minimal source offsets,
rename_param_plan, for editor / LSP use); bundle.py extends the rename across a
tool and its imported macro files (ToolBundle / load_bundle /
rename_param_in_bundle); version_tokens.py factors a literal version into the
@TOOL_VERSION@ / @VERSION_SUFFIX@ IUC tokens, owning the GTR094 decision, the
expansion-equality gate, the tree mutation, and the offset planner
tokenize_version_plan (the editor / LSP and CLI rendering, like
rename_param_plan); it also owns the Galaxy revision-suffix bump primitives the
bump-version-suffix command builds on (current_suffix,
bump_suffix_skip_reason, the in-place bump_suffix_tree, and the SuffixSite /
SuffixSiteKind site descriptors); rst.py / rst_markdown.py own the <help>
reStructuredText subsystem — validity + surgical repair (the GTR089 partition seam)
and the render-equivalence-gated RST → Markdown conversion (GTR092; needs the
[markdown] extra); models/ holds an xsdata-generated
read-only typed model for every vendored schema version, reached via
ToolDocument.model().
License
MIT — see LICENSE.
Metadata
Release files for galaxy-tool-source 0.3.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| galaxy_tool_source-0.3.9.tar.gz | 3.7 MB | With provenance | Details for galaxy_tool_source-0.3.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| galaxy_tool_source-0.3.9-py3-none-any.whl | Python 3 | none | any | Details for galaxy_tool_source-0.3.9-py3-none-any.whl |
Total release size: 7.3 MB
Release files / galaxy_tool_source-0.3.9.tar.gz
| Download URL | galaxy_tool_source-0.3.9.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c28728286d5cb5bbc6f24ed1138806f0b496783fa1e722d7e8a07b0647d4333
|
|
BLAKE2b-256 checksum How to use checksums |
0b9efdf999476826b368c8456e5a522375cb5bd2d99e8aa09f1e59c3c2a12d0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logRelease files / galaxy_tool_source-0.3.9-py3-none-any.whl
| Download URL | galaxy_tool_source-0.3.9-py3-none-any.whl |
|---|---|
| Size | 3.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3c6c4524f1aae29af474e5c9cdaa55b6b2c620112c3bbbd3863ead61f0c7564
|
|
BLAKE2b-256 checksum How to use checksums |
416b7c1d9c242d803286d95df172ff67c7d27b79ecebf49dc2542407a3f837f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logSecurity for galaxy-tool-source 0.3.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for galaxy_tool_source-0.3.9.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.