Skip to content

Commit

Permalink
Release 0.17.0
Browse files Browse the repository at this point in the history
Also:
- Using the deprecated ``history_id`` parameter of the
  ``HistoryClient.get_histories()`` method now raises a ``ValueError``
  exception.
- Docs fixes.
  • Loading branch information
nsoranzo committed May 9, 2022
1 parent 9c8095c commit d676872
Show file tree
Hide file tree
Showing 17 changed files with 137 additions and 88 deletions.
2 changes: 1 addition & 1 deletion ABOUT.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interacting with `Galaxy`_ and `CloudMan`_ APIs.
BioBlend is supported and tested on:

- Python 3.7, 3.8, 3.9 and 3.10
- Galaxy release_17.09 and later.
- Galaxy release 17.09 and later.

BioBlend's goal is to make it easier to script and automate the running of
Galaxy analyses, administering of a Galaxy server, and cloud infrastructure
Expand Down
61 changes: 55 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,63 @@
### BioBlend v - unreleased
### BioBlend v0.17.0 - 2022-05-09

* Dropped support for Python 3.6. Added support for Python 3.10. Added support
for Galaxy release 21.09 and 22.01.

* Removed deprecated ``run_workflow()`` method of ``WorkflowClient``.

* Using the deprecated ``history_id`` parameter of the
``HistoryClient.get_histories()`` method now raises a ``ValueError``
exception.

* Made ``tool_inputs_update`` parameter of ``JobsClient.rerun_job()`` more
flexible.

* Added ``whoami()`` method to ``ConfigClient`` (thanks to
[cat-bro](https://github.com/cat-bro)).

* Added ``get_extra_files()`` method to ``HistoryClient``.

* Added ``build()`` and ``reload()`` methods to ``ToolClient`` (thanks to
[Jayadev Joshi](https://github.com/jaidevjoshi83) and
[cat-bro](https://github.com/cat-bro) respectively).

* Added ``get_repositories()`` method to ``ToolShedCategoryClient`` (thanks to
[cat-bro](https://github.com/cat-bro)).

* Added ``update_repository_metadata()`` method to ``ToolShedRepositoryClient``.

* Added ``order_by`` parameter to ``JobsClient.get_jobs()`` method.

* BioBlend.objects: Removed deprecated ``run()`` method of ``Workflow``.

* BioBlend.objects: Fail if multiple libraries/histories/workflows match when
deleting by name, instead of deleting them all.

* Improvements to type annotations, tests and documentation
* BioBlend.objects: in ``HistoryDatasetAssociation.get_stream()``, wait for
the dataset to be ready.

* BioBlend.objects: in ``Workflow.invoke()``, check that the workflow is mapped
and runnable before invoking, allow the ``inputs`` parameter to be an instance
of a ``Dataset`` subclass, and allow the ``history`` parameter to be the name
of a new history.

* BioBlend.objects: Added new ``datasets`` and ``dataset_collections``
attributes to ``GalaxyInstance`` objects, which are instances of the new
``ObjDatasetClient`` and ``ObjDatasetCollectionClient`` respectively.

* BioBlend.objects: Added ``refresh()``, ``get_outputs()`` and
``get_output_collections()`` methods to ``InvocationStep``.

* Fixed [error](https://github.com/galaxyproject/bioblend/issues/398) when
instantiating ``GalaxyInstance`` with ``email`` and ``password`` (reported by
[Peter Briggs](https://github.com/pjbriggs)).

* Fixed parameter validation errors for POST requests with attached files on
upcoming Galaxy 22.05.

* Code cleanups (thanks to [Martmists](https://github.com/Martmists-GH)).

* Improvements to type annotations, tests and documentation.

### BioBlend v0.16.0 - 2021-06-13

Expand Down Expand Up @@ -280,7 +329,7 @@
* BioBlend.objects: added ``update()`` method to ``LibraryDataset`` (thanks to
[Anthony Bretaudeau](https://github.com/abretaud)).

* Run tests with pytest instead of nose
* Run tests with pytest instead of nose.

### BioBlend v0.11.0 - 2018-04-18

Expand Down Expand Up @@ -413,7 +462,7 @@

* Added ``install_resolver_dependencies`` parameter to
``ToolShedClient.install_repository_revision()``, applicable for Galaxy
release_16.07 and later (thanks to
release 16.07 and later (thanks to
[Marius van den Beek](https://github.com/mvdbeek)).

* Improve ``DatasetClient.download_dataset()`` by downloading the dataset in
Expand Down Expand Up @@ -529,7 +578,7 @@
* Project source moved to new URL - https://github.com/galaxyproject/bioblend

* Huge improvements to automated testing, tests now run against Galaxy
release_14.02 and all later versions to ensure backward compatibility
release 14.02 and all later versions to ensure backward compatibility
(see `.travis.yml` for details).

* Many documentation improvements (thanks to
Expand All @@ -553,7 +602,7 @@
deployments.

* Made ``LibraryClient._get_root_folder_id()`` method safer and faster for
Galaxy release_13.06 and later.
Galaxy release 13.06 and later.

* Deprecate and ignore invalid ``deleted`` parameter to
``WorkflowClient.get_workflows()``.
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ APIs.
BioBlend is supported and tested on:

- Python 3.7, 3.8, 3.9 and 3.10
- Galaxy release_17.09 and later.
- Galaxy release 17.09 and later.

Full docs are available at https://bioblend.readthedocs.io/ with a quick library
overview also available in `ABOUT.rst <./ABOUT.rst>`_.
Expand Down
2 changes: 1 addition & 1 deletion bioblend/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)

# Current version of the library
__version__ = '0.16.0'
__version__ = '0.17.0'

# default chunk size (in bytes) for reading remote data
try:
Expand Down
1 change: 1 addition & 0 deletions bioblend/galaxy/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def whoami(self):
:rtype: dict
:return: Information about current authenticated user
For example::
{'active': True,
'deleted': False,
'email': '[email protected]',
Expand Down
2 changes: 1 addition & 1 deletion bioblend/galaxy/dataset_collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def download_dataset_collection(self, dataset_collection_id: str, file_path: str
.. note::
This method downloads a ``zip`` archive for Galaxy 21.01 and later.
For earlier versions of Galaxy this method downloads a ``tgz`` archive.
This method is only supported by Galaxy 18.01 or later.
This method works only on Galaxy 18.01 or later.
"""
url = self._make_url(module_id=dataset_collection_id) + '/download'
r = self.gi.make_get_request(url, stream=True)
Expand Down
4 changes: 2 additions & 2 deletions bioblend/galaxy/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def publish_dataset(self, dataset_id: str, published: bool = False):
:return: Current roles for all available permission types.
.. note::
This method can only be used with Galaxy ``release_19.05`` or later.
This method works only on Galaxy 19.05 or later.
"""
payload: Dict[str, Any] = {
'action': 'remove_restrictions' if published else 'make_private'
Expand Down Expand Up @@ -349,7 +349,7 @@ def update_permissions(self, dataset_id: str, access_ids: Optional[list] = None,
:return: Current roles for all available permission types.
.. note::
This method can only be used with Galaxy ``release_19.05`` or later.
This method works only on Galaxy 19.05 or later.
"""
payload: Dict[str, Any] = {
'action': 'set_permissions'
Expand Down
38 changes: 14 additions & 24 deletions bioblend/galaxy/histories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import re
import sys
import time
import warnings
import webbrowser
from typing import List
from urllib.parse import urljoin
Expand Down Expand Up @@ -56,12 +55,10 @@ def import_history(self, file_path=None, url=None):

return self._post(payload=payload, files_attached=file_path is not None)

def _get_histories(self, history_id=None, name=None, deleted=False, filter_user_published=None, get_all_published=False, slug=None):
def _get_histories(self, name=None, deleted=False, filter_user_published=None, get_all_published=False, slug=None):
"""
Hidden method to be used by both get_histories() and get_published_histories()
"""
if history_id is not None and name is not None:
raise ValueError('Provide only one argument between name or history_id, but not both')
assert not (filter_user_published is not None and get_all_published)

params = {}
Expand All @@ -78,10 +75,7 @@ def _get_histories(self, history_id=None, name=None, deleted=False, filter_user_
url = '/'.join((self._make_url(), 'published')) if get_all_published else None
histories = self._get(url=url, params=params)

if history_id is not None:
history = next((_ for _ in histories if _['id'] == history_id), None)
histories = [history] if history is not None else []
elif name is not None:
if name is not None:
histories = [_ for _ in histories if _['name'] == name]
return histories

Expand All @@ -90,13 +84,6 @@ def get_histories(self, history_id=None, name=None, deleted=False, published=Non
Get all histories, or select a subset by specifying optional arguments
for filtering (e.g. a history name).
:type history_id: str
:param history_id: Encoded history ID to filter on
.. deprecated:: 0.15.0
To get details of a history for which you know the ID, use the much
more efficient :meth:`show_history` instead.
:type name: str
:param name: History name to filter on.
Expand All @@ -116,13 +103,16 @@ def get_histories(self, history_id=None, name=None, deleted=False, published=Non
:rtype: list
:return: List of history dicts.
.. versionchanged:: 0.17.0
Using the deprecated ``history_id`` parameter now raises a
``ValueError`` exception.
"""
if history_id is not None:
warnings.warn(
'The history_id parameter is deprecated, use the show_history() method to view details of a history for which you know the ID.',
category=FutureWarning
raise ValueError(
'The history_id parameter has been removed, use the show_history() method to view details of a history for which you know the ID.',
)
return self._get_histories(history_id=history_id, name=name, deleted=deleted, filter_user_published=published, get_all_published=False, slug=slug)
return self._get_histories(name=name, deleted=deleted, filter_user_published=published, get_all_published=False, slug=slug)

def get_published_histories(self, name=None, deleted=False, slug=None):
"""
Expand Down Expand Up @@ -217,9 +207,9 @@ def delete_dataset(self, history_id, dataset_id, purge=False):
:return: None
.. note::
For the purge option to work, the Galaxy instance must have the
``allow_user_dataset_purge`` option set to ``true`` in the
``config/galaxy.yml`` configuration file.
The ``purge`` option works only if the Galaxy instance has the
``allow_user_dataset_purge`` option set to ``true`` in the
``config/galaxy.yml`` configuration file.
"""
url = '/'.join((self._make_url(history_id, contents=True), dataset_id))
payload = {}
Expand Down Expand Up @@ -542,7 +532,7 @@ def delete_history(self, history_id, purge=False):
purged).
.. note::
For the purge option to work, the Galaxy instance must have the
The ``purge`` option works only if the Galaxy instance has the
``allow_user_dataset_purge`` option set to ``true`` in the
``config/galaxy.yml`` configuration file.
"""
Expand Down Expand Up @@ -773,7 +763,7 @@ def get_extra_files(self, history_id: str, dataset_id: str) -> List[dict]:
:return: List of extra files
.. note::
This method is only supported by Galaxy 19.01 or later.
This method works only on Galaxy 19.01 or later.
"""
url = '/'.join((self._make_url(history_id, contents=True), dataset_id, 'extra_files'))
return self._get(url=url)
2 changes: 1 addition & 1 deletion bioblend/galaxy/invocations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def rerun_invocation(self, invocation_id: str, inputs_update: Optional[dict] = N
:return: A dict describing the new workflow invocation.
.. note::
This method can only be used with Galaxy ``release_21.01`` or later.
This method works only on Galaxy 21.01 or later.
"""
invocation_details = self.show_invocation(invocation_id)
workflow_id = invocation_details['workflow_id']
Expand Down
26 changes: 13 additions & 13 deletions bioblend/galaxy/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def get_jobs(self, state=None, history_id=None, invocation_id=None, tool_id=None
'update_time': '2014-03-01T16:05:39.558458'}]
.. note::
The following filtering options can only be used with Galaxy ``release_21.05`` or later:
user_id, limit, offset, workflow_id, invocation_id
The following options work only on Galaxy 21.05 or later: ``user_id``,
``limit``, ``offset``, ``workflow_id``, ``invocation_id``.
"""
params = {
'limit': limit,
Expand Down Expand Up @@ -204,7 +204,7 @@ def rerun_job(self, job_id, remap=False, tool_inputs_update=None, history_id=Non
:return: Information about outputs and the rerun job
.. note::
This method can only be used with Galaxy ``release_21.01`` or later.
This method works only on Galaxy 21.01 or later.
"""
job_rerun_params = self._build_for_rerun(job_id)
job_inputs = job_rerun_params['state_inputs']
Expand Down Expand Up @@ -277,7 +277,7 @@ def search_jobs(self, tool_id: str, inputs: dict, state: Optional[str] = None) -
``inputs`` and ``state``.
.. note::
This method is only supported by Galaxy 18.01 or later.
This method works only on Galaxy 18.01 or later.
"""
job_info = {
'tool_id': tool_id,
Expand Down Expand Up @@ -342,7 +342,7 @@ def report_error(self, job_id: str, dataset_id: str, message: str, email: str =
:return: dict containing job error reply
.. note::
This method is only supported by Galaxy 20.01 or later.
This method works only on Galaxy 20.01 or later.
"""
payload = {
"message": message,
Expand All @@ -366,7 +366,7 @@ def get_common_problems(self, job_id: str) -> dict:
:return: dict containing potential problems
.. note::
This method is only supported by Galaxy 19.05 or later.
This method works only on Galaxy 19.05 or later.
"""
url = self._make_url(module_id=job_id) + '/common_problems'
return self._get(url=url)
Expand Down Expand Up @@ -408,7 +408,7 @@ def resume_job(self, job_id: str) -> dict:
:return: dict containing output dataset associations
.. note::
This method is only supported by Galaxy 18.09 or later.
This method works only on Galaxy 18.09 or later.
"""
url = self._make_url(module_id=job_id) + '/resume'
return self._put(url=url)
Expand All @@ -425,8 +425,8 @@ def get_destination_params(self, job_id: str) -> dict:
:return: Destination parameters for the given job
.. note::
This method is only supported by Galaxy 20.05 or later and requires
the user to be an admin.
This method works only on Galaxy 20.05 or later and if the user is a
Galaxy admin.
"""
url = self._make_url(module_id=job_id) + '/destination_params'
return self._get(url=url)
Expand All @@ -440,8 +440,8 @@ def show_job_lock(self) -> bool:
:return: Status of the job lock
.. note::
This method is only supported by Galaxy 20.05 or later and requires
the user to be an admin.
This method works only on Galaxy 20.05 or later and if the user is a
Galaxy admin.
"""
url = self.gi.url + '/job_lock'
response = self._get(url=url)
Expand All @@ -457,8 +457,8 @@ def update_job_lock(self, active=False) -> bool:
:return: Updated status of the job lock
.. note::
This method is only supported by Galaxy 20.05 or later and requires
the user to be an admin.
This method works only on Galaxy 20.05 or later and if the user is a
Galaxy admin.
"""
payload = {
'active': active,
Expand Down
Loading

0 comments on commit d676872

Please sign in to comment.