From 0a4bcc79af33dd00a6a03216be32d10000bb432b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tibor=20=C5=A0imko?= Date: Mon, 2 Sep 2024 17:36:20 +0200 Subject: [PATCH 1/5] ci(actions): pin setuptools 70 (#728) Pin `setuptools` to the maximum version of 70 to allow working on Ubuntu 20.04 LTS based environments. (New versions of `setuptools` are not compatible.) Note that this fix is necessary only for the `maint-0.9` branches and the REANA 0.9 release series. In `master` we have switched to Ubuntu 24.04 LTS based environments and Python 3.12 and no pinning is necessary there. --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c45a796..cd8e2f05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -142,7 +142,7 @@ jobs: - name: Install Python dependencies run: | - pip install --upgrade pip setuptools py + pip install --upgrade pip 'setuptools<71' py pip install -e .[all] - name: Verify reana client commands list @@ -160,7 +160,7 @@ jobs: - name: Install Python dependencies run: | - pip install --upgrade pip setuptools py + pip install --upgrade pip 'setuptools<71' py pip install -e .[all] - name: Verify reana client api docs @@ -178,7 +178,7 @@ jobs: - name: Install Python dependencies run: | - pip install --upgrade pip setuptools py + pip install --upgrade pip 'setuptools<71' py pip install -e .[all] - name: Run Sphinx documentation with doctests @@ -200,7 +200,7 @@ jobs: - name: Setup requirements builder run: | - pip install --upgrade pip setuptools py + pip install --upgrade pip 'setuptools<71' py pip install wheel pip install requirements-builder if [[ ${{ matrix.testenv }} == lowest ]]; then From c822dd6570d5474e535be83d0ee4beb44ecee85b Mon Sep 17 00:00:00 2001 From: Clemens Lange Date: Fri, 5 Apr 2024 11:45:22 -0500 Subject: [PATCH 2/5] docs(cli): fix `open` command documentation typo (#728) Cherry-picked from 9a4dfc2d5dccf6d3bc0290719f0ad6bb3dc3735a --- AUTHORS.md | 1 + reana_client/cli/workflow.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index 8f1e1433..d728b4bd 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -6,6 +6,7 @@ The list of contributors in alphabetical order: - [Anton Khodak](https://orcid.org/0000-0003-3263-4553) - [Audrius Mecionis](https://orcid.org/0000-0002-3759-1663) - [Camila Diaz](https://orcid.org/0000-0001-5543-797X) +- [Clemens Lange](https://orcid.org/0000-0002-3632-3157) - [Daniel Prelipcean](https://orcid.org/0000-0002-4855-194X) - [Diego Rodriguez](https://orcid.org/0000-0003-0649-2002) - [Dinos Kousidis](https://orcid.org/0000-0002-4914-4289) diff --git a/reana_client/cli/workflow.py b/reana_client/cli/workflow.py index dbcf506a..12b4eb68 100644 --- a/reana_client/cli/workflow.py +++ b/reana_client/cli/workflow.py @@ -1366,7 +1366,7 @@ def workflow_open_interactive_session( The ``open`` command allows to open interactive session processes on top of the workflow workspace, such as Jupyter notebooks. This is useful to - quickly inspect and analyse the produced files while the workflow is stlil + quickly inspect and analyse the produced files while the workflow is still running. Examples:\n From fd9b9446d58f21cc6e57b343874d55433532c959 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jelizaveta=20Leme=C5=A1eva?= Date: Wed, 9 Oct 2024 16:45:21 +0200 Subject: [PATCH 3/5] build(python): add support for Python 3.13 (#736) Closes reanahub/reana#837 --- .github/workflows/ci.yml | 2 +- reana_client/api/client.py | 8 ++++---- reana_client/api/utils.py | 18 +++++++++++++++++- setup.py | 1 + tests/test_api_utils.py | 33 +++++++++++++++++++++++++++++++++ tox.ini | 10 +++++++++- 6 files changed, 65 insertions(+), 7 deletions(-) create mode 100644 tests/test_api_utils.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd8e2f05..e9972b77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -189,7 +189,7 @@ jobs: strategy: matrix: testenv: [lowest, release] - python: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] + python: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 diff --git a/reana_client/api/client.py b/reana_client/api/client.py index ecdfd5e4..0c58bc96 100644 --- a/reana_client/api/client.py +++ b/reana_client/api/client.py @@ -7,7 +7,6 @@ # under the terms of the MIT License; see LICENSE file for more details. """REANA REST API client.""" -import cgi import json import logging import os @@ -27,6 +26,7 @@ from reana_commons.errors import REANASecretAlreadyExists, REANASecretDoesNotExist from werkzeug.local import LocalProxy +from reana_client.api.utils import get_content_disposition_filename from reana_client.config import ERROR_MESSAGES from reana_client.errors import FileDeletionError, FileUploadError from reana_client.utils import is_uuid_v4, is_regular_path @@ -492,9 +492,9 @@ def download_file(workflow, file_name, access_token): verify=False, ) if "Content-Disposition" in http_response.headers: - content_disposition = http_response.headers.get("Content-Disposition") - value, params = cgi.parse_header(content_disposition) - file_name = params.get("filename", "downloaded_file") + file_name = get_content_disposition_filename( + http_response.headers.get("Content-Disposition") + ) # A zip archive is downloaded if multiple files are requested multiple_files_zipped = ( diff --git a/reana_client/api/utils.py b/reana_client/api/utils.py index e781ddcd..dc226058 100644 --- a/reana_client/api/utils.py +++ b/reana_client/api/utils.py @@ -1,12 +1,14 @@ # -*- coding: utf-8 -*- # # This file is part of REANA. -# Copyright (C) 2019, 2020, 2021 CERN. +# Copyright (C) 2019, 2020, 2021, 2024 CERN. # # REANA is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. """REANA client API utils.""" +from email.message import Message + def get_path_from_operation_id(paths_dict, operation_id): """Find API path based on operation id.""" @@ -17,3 +19,17 @@ def get_path_from_operation_id(paths_dict, operation_id): if paths_dict[path][method]["operationId"] == operation_id: return path return None + + +def get_content_disposition_filename(content_disposition_header): + """Retrieve filename from a Content-Disposition like header. + + Using email module instead of cgi.parse header due to https://peps.python.org/pep-0594/#cgi + + Return a filename if found, otherwise a default string. + """ + msg = Message() + msg["content-disposition"] = content_disposition_header + filename = msg.get_filename() + + return filename if filename else "downloaded_file" diff --git a/setup.py b/setup.py index 382e5c46..8009023c 100644 --- a/setup.py +++ b/setup.py @@ -101,6 +101,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", diff --git a/tests/test_api_utils.py b/tests/test_api_utils.py new file mode 100644 index 00000000..04f6a43f --- /dev/null +++ b/tests/test_api_utils.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- +# +# This file is part of REANA. +# Copyright (C) 2024 CERN. +# +# REANA is free software; you can redistribute it and/or modify it +# under the terms of the MIT License; see LICENSE file for more details. + +"""REANA API utils tests.""" + +import pytest + +from reana_client.api.utils import get_content_disposition_filename + + +@pytest.mark.parametrize( + "content_disposition_header, expected_filename", + [ + ("inline", "downloaded_file"), + ("attachment", "downloaded_file"), + ('attachment; filename="example.txt"', "example.txt"), + ("attachment; filename*=UTF-8''example.txt", "example.txt"), + ("attachment; filename=folder", "folder"), + ('attachment; filename="folder/*/example.txt"', "folder/*/example.txt"), + ], +) +def test_get_content_disposition_filename( + content_disposition_header, expected_filename +): + assert ( + get_content_disposition_filename(content_disposition_header) + == expected_filename + ) diff --git a/tox.ini b/tox.ini index 9904a694..81399019 100644 --- a/tox.ini +++ b/tox.ini @@ -5,7 +5,15 @@ # under the terms of the MIT License; see LICENSE file for more details. [tox] -envlist = py36, py37, py38, py39, py310, py311, py312 +envlist = + py36 + py37 + py38 + py39 + py310 + py311 + py312 + py313 [testenv] deps = pytest From 778df037dbeb1340478060e7f913dfff7c0235e5 Mon Sep 17 00:00:00 2001 From: Marco Donadoni Date: Thu, 28 Nov 2024 11:39:55 +0100 Subject: [PATCH 4/5] build(python): bump shared REANA packages as of 2024-11-28 (#736) --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8009023c..cb174a08 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ "click>=7", "pathspec==0.9.0", "jsonpointer>=2.0", - "reana-commons[yadage,snakemake,cwl]>=0.9.8,<0.10.0", + "reana-commons[yadage,snakemake,cwl]>=0.9.9,<0.10.0", "tablib>=0.12.1,<0.13", "werkzeug>=0.14.1 ; python_version<'3.10'", "werkzeug>=0.15.0 ; python_version>='3.10'", From 6766412d4584654dda7ec842a3db54adb70685a1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:00:50 +0000 Subject: [PATCH 5/5] chore(maint-0.9): release 0.9.4 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 19 +++++++++++++++++++ reana_client/version.py | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ee2bfff4..1b1f6a80 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.3" + ".": "0.9.4" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 01305b2d..28d24528 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [0.9.4](https://github.com/reanahub/reana-client/compare/0.9.3...0.9.4) (2024-11-29) + + +### Build + +* **docker:** create `reana-client` container image ([#710](https://github.com/reanahub/reana-client/issues/710)) ([2c99c5d](https://github.com/reanahub/reana-client/commit/2c99c5d1bd36e4303885875375085f7d714e8732)), closes [#709](https://github.com/reanahub/reana-client/issues/709) +* **python:** add support for Python 3.13 ([#736](https://github.com/reanahub/reana-client/issues/736)) ([fd9b944](https://github.com/reanahub/reana-client/commit/fd9b9446d58f21cc6e57b343874d55433532c959)) +* **python:** bump shared REANA packages as of 2024-11-28 ([#736](https://github.com/reanahub/reana-client/issues/736)) ([778df03](https://github.com/reanahub/reana-client/commit/778df037dbeb1340478060e7f913dfff7c0235e5)) + + +### Continuous integration + +* **actions:** pin setuptools 70 ([#728](https://github.com/reanahub/reana-client/issues/728)) ([0a4bcc7](https://github.com/reanahub/reana-client/commit/0a4bcc79af33dd00a6a03216be32d10000bb432b)) + + +### Documentation + +* **cli:** fix `open` command documentation typo ([#728](https://github.com/reanahub/reana-client/issues/728)) ([c822dd6](https://github.com/reanahub/reana-client/commit/c822dd6570d5474e535be83d0ee4beb44ecee85b)) + ## [0.9.3](https://github.com/reanahub/reana-client/compare/0.9.2...0.9.3) (2024-03-13) diff --git a/reana_client/version.py b/reana_client/version.py index 9eb345f2..c49c32e0 100644 --- a/reana_client/version.py +++ b/reana_client/version.py @@ -14,4 +14,4 @@ from __future__ import absolute_import, print_function -__version__ = "0.9.3" +__version__ = "0.9.4"