Skip to content

Commit ee8e7ae

Browse files
authored
Merge pull request #529 from anuprulez/main
Adds a method to extract tool's helptext
2 parents 0773740 + 89bc932 commit ee8e7ae

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22

33
* Dropped support for Python 3.9. Added support for Galaxy release 26.0.
44

5+
* Added ``copy_history()`` method to ``HistoryClient`` (thanks to
6+
[Peter van Heusden ](https://github.com/pvanheus)).
7+
8+
* Added ``get_tool_source()`` method to ``ToolClient`` (thanks to
9+
[Anup Kumar](https://github.com/anuprulez)).
10+
511
* Added ``preferred_object_store_id`` parameter to
612
``HistoryClient.update_history()``.
713

14+
* Improvements to documentation and tests.
15+
816
## BioBlend v1.7.0 - 2025-11-07
917

1018
* Deprecation: this is the last release to support end-of-life Python 3.9.

bioblend/_tests/TestGalaxyTools.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,10 @@ def test_get_tool_tests(self):
175175
assert first_test["tool_id"] == "random_lines1", first_test
176176
assert "inputs" in first_test
177177
assert "outputs" in first_test
178+
179+
@test_util.skip_unless_galaxy("release_22.01")
180+
@test_util.skip_unless_tool("random_lines1")
181+
def test_get_tool_source(self):
182+
tool_source = self.gi.tools.get_tool_source("random_lines1")
183+
assert tool_source.startswith("<tool")
184+
assert tool_source.endswith("</tool>")

bioblend/galaxy/tools/__init__.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,26 @@ def uninstall_dependencies(self, tool_id: str) -> dict:
182182
url = self._make_url(tool_id) + "/dependencies"
183183
return self._delete(url=url)
184184

185+
def get_tool_source(self, tool_id: str) -> str:
186+
"""
187+
Get the raw tool XML source for a given tool ID.
188+
189+
:type tool_id: str
190+
:param tool_id: id of the requested tool
191+
192+
:rtype: str
193+
:return: Tool XML source as a string
194+
195+
.. note::
196+
This method works only on Galaxy 22.01 or later and if the user is a
197+
Galaxy admin or the Galaxy instance has the
198+
``enable_tool_source_display`` option set to ``true`` in the
199+
``config/galaxy.yml`` configuration file.
200+
"""
201+
raw_source_url = self._make_url(tool_id) + "/raw_tool_source"
202+
ht_response = self._get(url=raw_source_url, json=False)
203+
return ht_response.text
204+
185205
def show_tool(self, tool_id: str, io_details: bool = False, link_details: bool = False) -> dict[str, Any]:
186206
"""
187207
Get details of a given tool.
@@ -216,7 +236,8 @@ def get_tool_tests(self, tool_id: str, tool_version: str | None = None) -> list[
216236
the tests for all available tool versions.
217237
218238
:rtype: list
219-
:return: List of test case definitions, e.g.::
239+
:return: List of test case definitions.
240+
For example::
220241
221242
[
222243
{
@@ -551,10 +572,10 @@ def post_to_fetch(self, path: str, history_id: str, session_id: str, **kwargs: A
551572
:type session_id: str
552573
:param session_id: Session ID returned by the tus service
553574
554-
See :meth:`upload_file` for additional parameters.
555-
556575
:rtype: dict
557576
:return: Information about the created upload job
577+
578+
See :meth:`upload_file` for additional parameters.
558579
"""
559580
payload = self._fetch_payload(path, history_id, session_id, **kwargs)
560581
url = "/".join((self.gi.url, "tools/fetch"))
@@ -571,10 +592,10 @@ def upload_from_ftp(self, path: str, history_id: str, **kwargs: Any) -> dict[str
571592
:type history_id: str
572593
:param history_id: id of the history where to upload the file
573594
574-
See :meth:`upload_file` for the optional parameters.
575-
576595
:rtype: dict
577596
:return: Information about the created upload job
597+
598+
See :meth:`upload_file` for the optional parameters.
578599
"""
579600
payload = self._upload_payload(history_id, **kwargs)
580601
payload["files_0|ftp_files"] = path

bioblend/galaxy/workflows/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,17 @@ def invoke_workflow(
422422
423423
:type preferred_object_store_id: str
424424
:param preferred_object_store_id: The object store id where you want all
425-
outputs of this workflow run be stored.
425+
outputs of this workflow run be stored.
426426
427427
:type preferred_intermediate_object_store_id: str
428428
:param preferred_intermediate_object_store_id: The object store id where
429-
you want the intermediate outputs of this workflow run to be stored.
430-
Cannot be set if ``preferred_object_store_id`` is set.
429+
you want the intermediate outputs of this workflow run to be stored.
430+
Cannot be set if ``preferred_object_store_id`` is set.
431431
432432
:type preferred_outputs_object_store_id: str
433433
:param preferred_outputs_object_store_id: The object store id where
434-
you want the priamry outputs of this workflow run to be stored.
435-
Cannot be set if ``preferred_object_store_id`` is set.
434+
you want the priamry outputs of this workflow run to be stored.
435+
Cannot be set if ``preferred_object_store_id`` is set.
436436
437437
:rtype: dict
438438
:return: A dict containing the workflow invocation describing the

0 commit comments

Comments
 (0)