Skip to content

Commit

Permalink
Merge pull request #3178 from MatthiasZepper/download_cli_refactor
Browse files Browse the repository at this point in the history
Changes to nf-core pipelines download CLI
  • Loading branch information
MatthiasZepper authored Oct 1, 2024
2 parents f6f0b3c + 5dea0d0 commit 2a35da1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 29 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,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))
Expand Down
23 changes: 6 additions & 17 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -420,7 +412,7 @@ def command_pipelines_lint(
help="List of images already available in a remote `singularity.cacheDir`.",
)
@click.option(
"-p",
"-d",
"--parallel-downloads",
type=int,
default=4,
Expand All @@ -434,7 +426,6 @@ def command_pipelines_download(
outdir,
compress,
force,
tower,
platform,
download_configuration,
tag,
Expand All @@ -454,7 +445,6 @@ def command_pipelines_download(
outdir,
compress,
force,
tower,
platform,
download_configuration,
tag,
Expand Down Expand Up @@ -2120,8 +2110,7 @@ def command_download(
outdir,
compress,
force,
tower,
platform,
platform or tower,
download_configuration,
tag,
container_system,
Expand Down
6 changes: 1 addition & 5 deletions nf_core/commands_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def pipelines_download(
outdir,
compress,
force,
tower,
platform,
download_configuration,
tag,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down
6 changes: 2 additions & 4 deletions nf_core/pipelines/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"],),
Expand Down

0 comments on commit 2a35da1

Please sign in to comment.