Skip to content

Commit 89bc932

Browse files
committed
Simplify code and improve documentation
1 parent e6b97fe commit 89bc932

File tree

4 files changed

+30
-24
lines changed

4 files changed

+30
-24
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: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,5 @@ def test_get_tool_tests(self):
180180
@test_util.skip_unless_tool("random_lines1")
181181
def test_get_tool_source(self):
182182
tool_source = self.gi.tools.get_tool_source("random_lines1")
183-
assert isinstance(tool_source, str)
184-
assert tool_source
185-
assert "<tool" in tool_source.lower()
186-
assert "</tool>" in tool_source.lower()
187-
assert "<test>" in tool_source.lower()
188-
assert "</test>" in tool_source.lower()
189-
assert "<help>" in tool_source.lower()
190-
assert "</help>" in tool_source.lower()
183+
assert tool_source.startswith("<tool")
184+
assert tool_source.endswith("</tool>")

bioblend/galaxy/tools/__init__.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,16 @@ def get_tool_source(self, tool_id: str) -> str:
191191
192192
:rtype: str
193193
: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.
194200
"""
195-
try:
196-
raw_source_url = self._make_url(tool_id) + "/raw_tool_source"
197-
ht_response = self._get(url=raw_source_url, json=False)
198-
return ht_response.text
199-
except Exception as e:
200-
raise RuntimeError(f"Could not retrieve tool source for tool '{tool_id}': {e}")
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
201204

202205
def show_tool(self, tool_id: str, io_details: bool = False, link_details: bool = False) -> dict[str, Any]:
203206
"""
@@ -233,7 +236,8 @@ def get_tool_tests(self, tool_id: str, tool_version: str | None = None) -> list[
233236
the tests for all available tool versions.
234237
235238
:rtype: list
236-
:return: List of test case definitions, e.g.::
239+
:return: List of test case definitions.
240+
For example::
237241
238242
[
239243
{
@@ -568,10 +572,10 @@ def post_to_fetch(self, path: str, history_id: str, session_id: str, **kwargs: A
568572
:type session_id: str
569573
:param session_id: Session ID returned by the tus service
570574
571-
See :meth:`upload_file` for additional parameters.
572-
573575
:rtype: dict
574576
:return: Information about the created upload job
577+
578+
See :meth:`upload_file` for additional parameters.
575579
"""
576580
payload = self._fetch_payload(path, history_id, session_id, **kwargs)
577581
url = "/".join((self.gi.url, "tools/fetch"))
@@ -588,10 +592,10 @@ def upload_from_ftp(self, path: str, history_id: str, **kwargs: Any) -> dict[str
588592
:type history_id: str
589593
:param history_id: id of the history where to upload the file
590594
591-
See :meth:`upload_file` for the optional parameters.
592-
593595
:rtype: dict
594596
:return: Information about the created upload job
597+
598+
See :meth:`upload_file` for the optional parameters.
595599
"""
596600
payload = self._upload_payload(history_id, **kwargs)
597601
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)