From ae5084038ac5712e12566eb39ebd0aab593942be Mon Sep 17 00:00:00 2001 From: Matthias Zepper Date: Mon, 23 Sep 2024 19:18:21 +0200 Subject: [PATCH 1/3] Refactor CLI commands for Download. --- nf_core/__main__.py | 20 +++++--------------- nf_core/pipelines/download.py | 6 ++---- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index c7e927c8c8..9255c53bd1 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -366,26 +366,18 @@ def command_pipelines_lint( help="Archive compression type", ) @click.option("-f", "--force", is_flag=True, default=False, help="Overwrite existing files") -# TODO: Remove this in a future release. Deprecated in March 2024. -@click.option( - "-t", - "--tower", - is_flag=True, - default=False, - hidden=True, - help="Download for Seqera Platform. DEPRECATED: Please use `--platform` instead.", -) @click.option( + "-p", "--platform", is_flag=True, default=False, help="Download for Seqera Platform (formerly Nextflow Tower)", ) @click.option( - "-d", + "-c", "--download-configuration", - is_flag=True, - default=False, + type=click.Choice(["yes", "no"]), + default="no", help="Include configuration profiles in download. Not available with `--platform`", ) @click.option( @@ -420,7 +412,7 @@ def command_pipelines_lint( help="List of images already available in a remote `singularity.cacheDir`.", ) @click.option( - "-p", + "-n", "--parallel-downloads", type=int, default=4, @@ -434,7 +426,6 @@ def command_pipelines_download( outdir, compress, force, - tower, platform, download_configuration, tag, @@ -454,7 +445,6 @@ def command_pipelines_download( outdir, compress, force, - tower, platform, download_configuration, tag, diff --git a/nf_core/pipelines/download.py b/nf_core/pipelines/download.py index 97453b127e..7018dc7b42 100644 --- a/nf_core/pipelines/download.py +++ b/nf_core/pipelines/download.py @@ -133,10 +133,8 @@ def __init__( self.force = force self.platform = platform self.fullname: Optional[str] = None - # if flag is not specified, do not assume deliberate choice and prompt config inclusion interactively. - # this implies that non-interactive "no" choice is only possible implicitly (e.g. with --platform or if prompt is suppressed by !stderr.is_interactive). - # only alternative would have been to make it a parameter with argument, e.g. -d="yes" or -d="no". - self.include_configs = True if download_configuration else False if bool(platform) else None + # downloading configs is not supported for Seqera Platform downloads. + self.include_configs = True if download_configuration == "yes" and not bool(platform) else False # Additional tags to add to the downloaded pipeline. This enables to mark particular commits or revisions with # additional tags, e.g. "stable", "testing", "validated", "production" etc. Since this requires a git-repo, it is only # available for the bare / Seqera Platform download. From 95435c9c58cb556a096906bf368549e18de21799 Mon Sep 17 00:00:00 2001 From: Matthias Zepper Date: Mon, 23 Sep 2024 19:55:51 +0200 Subject: [PATCH 2/3] Adapt tests for the new Pipelines Download CLI. --- nf_core/__main__.py | 3 +-- nf_core/commands_pipelines.py | 6 +----- tests/test_cli.py | 4 ++-- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 9255c53bd1..98673fe1ee 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -2110,8 +2110,7 @@ def command_download( outdir, compress, force, - tower, - platform, + platform or tower, download_configuration, tag, container_system, diff --git a/nf_core/commands_pipelines.py b/nf_core/commands_pipelines.py index 23affb1d27..1186935e52 100644 --- a/nf_core/commands_pipelines.py +++ b/nf_core/commands_pipelines.py @@ -167,7 +167,6 @@ def pipelines_download( outdir, compress, force, - tower, platform, download_configuration, tag, @@ -185,16 +184,13 @@ def pipelines_download( """ from nf_core.pipelines.download import DownloadWorkflow - if tower: - log.warning("[red]The `-t` / `--tower` flag is deprecated. Please use `--platform` instead.[/]") - dl = DownloadWorkflow( pipeline, revision, outdir, compress, force, - tower or platform, # True if either specified + platform, download_configuration, tag, container_system, diff --git a/tests/test_cli.py b/tests/test_cli.py index 026efd1e6a..bea0223f06 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -167,7 +167,7 @@ def test_cli_download(self, mock_dl): "compress": "tar.gz", "force": None, "platform": None, - "download-configuration": None, + "download-configuration": "yes", "tag": "3.12=testing", "container-system": "singularity", "container-library": "quay.io", @@ -188,7 +188,7 @@ def test_cli_download(self, mock_dl): params["compress"], "force" in params, "platform" in params, - "download-configuration" in params, + params["download-configuration"], (params["tag"],), params["container-system"], (params["container-library"],), From 5dea0d032a52cfa2779b487baa5e38aaa5421cd1 Mon Sep 17 00:00:00 2001 From: Matthias Zepper Date: Mon, 23 Sep 2024 20:24:10 +0200 Subject: [PATCH 3/3] Fix GitHub Action in pipeline-template and update Changelog. --- CHANGELOG.md | 11 +++++++++++ nf_core/__main__.py | 2 +- .../.github/workflows/download_pipeline.yml | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a11aee515..bc740a8030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,17 @@ - Components: allow spaces at the beginning of include statements ([#3115](https://github.com/nf-core/tools/pull/3115)) - Add option `--fix` to update the `meta.yml` file of subworkflows ([#3077](https://github.com/nf-core/tools/pull/3077)) +### Download + +- Fully removed already deprecated `-t` / `--tower` flag. +- Refactored the CLI for consistency (short flag is usually second word, e.g. also for `--container-library` etc.): + +| Old parameter | New parameter | +| --------------------------------- | --------------------------------- | +| `-d` / `--download-configuration` | `-c` / `--download-configuration` | +| `-p` / `--parallel-downloads` | `-d` / `--parallel-downloads` | +| new parameter | `-p` / (`--platform`) | + ### General - Update output of generation script for API docs to new structure ([#2988](https://github.com/nf-core/tools/pull/2988)) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 98673fe1ee..e0c1b85e91 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -412,7 +412,7 @@ def command_pipelines_lint( help="List of images already available in a remote `singularity.cacheDir`.", ) @click.option( - "-n", + "-d", "--parallel-downloads", type=int, default=4, diff --git a/nf_core/pipeline-template/.github/workflows/download_pipeline.yml b/nf_core/pipeline-template/.github/workflows/download_pipeline.yml index e7a28e5ac4..f704609ca8 100644 --- a/nf_core/pipeline-template/.github/workflows/download_pipeline.yml +++ b/nf_core/pipeline-template/.github/workflows/download_pipeline.yml @@ -65,7 +65,7 @@ jobs: --container-system 'singularity' \ --container-library "quay.io" -l "docker.io" -l "ghcr.io" \ --container-cache-utilisation 'amend' \ - --download-configuration + --download-configuration 'yes' - name: Inspect download run: tree ./${{ env.REPOTITLE_LOWERCASE }}{% endraw %}{% if test_config %}{% raw %}