Foundation library for parsing, profile-aware validation, and typed inspection of Galaxy tool XML
Project description
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
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
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
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.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.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); 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file galaxy_tool_source-0.1.0.tar.gz.
File metadata
- Download URL: galaxy_tool_source-0.1.0.tar.gz
- Upload date:
- Size: 3.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e07eb380bdb0509c823dabbf78bea1cd3cc96d2b0af36316dd971a4b2ea5f4f
|
|
| MD5 |
5e4603da43beb5f76df887a8f33de8ce
|
|
| BLAKE2b-256 |
80195771e874ffa24c78c0ab4eecabdbf93deed9573e8a6b1afafd090b209b8d
|
Provenance
The following attestation bundles were made for galaxy_tool_source-0.1.0.tar.gz:
Publisher:
release.yml on richard-burhans/galaxy-tool-refactor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
galaxy_tool_source-0.1.0.tar.gz -
Subject digest:
8e07eb380bdb0509c823dabbf78bea1cd3cc96d2b0af36316dd971a4b2ea5f4f - Sigstore transparency entry: 1785348489
- Sigstore integration time:
-
Permalink:
richard-burhans/galaxy-tool-refactor@b69a5201490c11bb28b496ab19100730cbbd2449 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/richard-burhans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b69a5201490c11bb28b496ab19100730cbbd2449 -
Trigger Event:
push
-
Statement type:
File details
Details for the file galaxy_tool_source-0.1.0-py3-none-any.whl.
File metadata
- Download URL: galaxy_tool_source-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
674957f720d59232c0e034a30dce464dfe3da92fc50241c399fe3edd577d6ae0
|
|
| MD5 |
8f1091a8f172d5457c2cca09ca73648d
|
|
| BLAKE2b-256 |
49c50b79e97237c51c89311f098886aaa8179b2e4a44e9a3ba7dd891bd1d0ce8
|
Provenance
The following attestation bundles were made for galaxy_tool_source-0.1.0-py3-none-any.whl:
Publisher:
release.yml on richard-burhans/galaxy-tool-refactor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
galaxy_tool_source-0.1.0-py3-none-any.whl -
Subject digest:
674957f720d59232c0e034a30dce464dfe3da92fc50241c399fe3edd577d6ae0 - Sigstore transparency entry: 1785348622
- Sigstore integration time:
-
Permalink:
richard-burhans/galaxy-tool-refactor@b69a5201490c11bb28b496ab19100730cbbd2449 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/richard-burhans
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b69a5201490c11bb28b496ab19100730cbbd2449 -
Trigger Event:
push
-
Statement type: