From a40b9fd71d81eac5759b1e80226bcaaa997bc233 Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 23 Apr 2026 13:56:45 +0200 Subject: [PATCH 1/6] add `--force` parameter to `modules remove` and `subworkflow remove` --- nf_core/__main__.py | 22 ++++++++++++++++++---- nf_core/commands_modules.py | 4 ++-- nf_core/commands_subworkflows.py | 4 ++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index e05947148b..2954d7e080 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1130,11 +1130,18 @@ def command_modules_patch(ctx, tool, directory, remove): default=".", help=r"Pipeline directory. [dim]\[default: current working directory][/]", ) -def command_modules_remove(ctx, directory, tool): +@click.option( + "-f", + "--force", + is_flag=True, + default=False, + help="Force removal of the module, even if it is in included in the pipeline.", +) +def command_modules_remove(ctx, directory, tool, force): """ Remove a module from a pipeline. """ - modules_remove(ctx, directory, tool) + modules_remove(ctx, directory, tool, force) # nf-core modules create @@ -1789,11 +1796,18 @@ def subworkflows_patch(ctx, subworkflow, directory, remove): default=".", help=r"Pipeline directory. [dim]\[default: current working directory][/]", ) -def command_subworkflows_remove(ctx, directory, subworkflow): +@click.option( + "-f", + "--force", + is_flag=True, + default=False, + help="Force removal of the subworkflow, even if it is in included in the pipeline.", +) +def command_subworkflows_remove(ctx, directory, subworkflow, force): """ Remove a subworkflow from a pipeline. """ - subworkflows_remove(ctx, directory, subworkflow) + subworkflows_remove(ctx, directory, subworkflow, force) # nf-core subworkflows update diff --git a/nf_core/commands_modules.py b/nf_core/commands_modules.py index 6f9ce2baa1..7f5b991745 100644 --- a/nf_core/commands_modules.py +++ b/nf_core/commands_modules.py @@ -143,7 +143,7 @@ def modules_patch(ctx, tool, directory, remove): sys.exit(1) -def modules_remove(ctx, directory, tool): +def modules_remove(ctx, directory, tool, force): """ Remove a module from a pipeline. """ @@ -156,7 +156,7 @@ def modules_remove(ctx, directory, tool): ctx.obj["modules_repo_branch"], ctx.obj["modules_repo_no_pull"], ) - module_remove.remove(tool) + module_remove.remove(tool, force=force) except (UserWarning, LookupError) as e: log.critical(e) sys.exit(1) diff --git a/nf_core/commands_subworkflows.py b/nf_core/commands_subworkflows.py index d93b60fa78..193e976401 100644 --- a/nf_core/commands_subworkflows.py +++ b/nf_core/commands_subworkflows.py @@ -203,7 +203,7 @@ def subworkflows_install(ctx, subworkflow, directory, prompt, force, sha): sys.exit(1) -def subworkflows_remove(ctx, directory, subworkflow): +def subworkflows_remove(ctx, directory, subworkflow, force): """ Remove a subworkflow from a pipeline. """ @@ -216,7 +216,7 @@ def subworkflows_remove(ctx, directory, subworkflow): ctx.obj["modules_repo_branch"], ctx.obj["modules_repo_no_pull"], ) - module_remove.remove(subworkflow) + module_remove.remove(subworkflow, force=force) except (UserWarning, LookupError) as e: log.critical(e) sys.exit(1) From f367698be64171b32c019d2796277d289fad8077 Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 23 Apr 2026 13:58:02 +0200 Subject: [PATCH 2/6] fix missed include statements if workflows has subdirectories --- nf_core/components/components_command.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/components/components_command.py b/nf_core/components/components_command.py index d81e868c33..2e01c245d3 100644 --- a/nf_core/components/components_command.py +++ b/nf_core/components/components_command.py @@ -282,7 +282,7 @@ def check_if_in_include_stmts(self, component_path: str) -> dict[str, list[dict[ """ include_stmts: dict[str, list[dict[str, int | str]]] = {} if self.repo_type == "pipeline": - workflow_files = Path(self.directory, "workflows").glob("*.nf") + workflow_files = Path(self.directory, "workflows").rglob("*.nf") for workflow_file in workflow_files: with open(workflow_file) as fh, mmap.mmap(fh.fileno(), 0, access=mmap.ACCESS_READ) as s: # Check if component path is in the file using mmap From 22b9bd27871d6ee02f7df2a4b34fcb6abc671f0a Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Thu, 23 Apr 2026 12:00:29 +0000 Subject: [PATCH 3/6] [automated] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a1b54433a..4e73df4571 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -95,6 +95,7 @@ - update test to new upstream subworkflow structure ([#4038](https://github.com/nf-core/tools/pull/4038)) - Fix lint: preserve underscores for subworkflow includes via full path ([#4074](https://github.com/nf-core/tools/pull/4074)) - update modules and subworkflows in template ([#4077](https://github.com/nf-core/tools/pull/4077)) +- add `--force` parameter to `modules remove` and `subworkflow remove` ([#4213](https://github.com/nf-core/tools/pull/4213)) ### Template From 18c4d0b615c14e184c02d9cd0080ec7b8e1b2f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20H=C3=B6rtenhuber?= Date: Thu, 23 Apr 2026 15:11:17 +0200 Subject: [PATCH 4/6] Update nf_core/__main__.py Co-authored-by: Jonathan Manning --- nf_core/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 2954d7e080..0a470edcea 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1135,7 +1135,7 @@ def command_modules_patch(ctx, tool, directory, remove): "--force", is_flag=True, default=False, - help="Force removal of the module, even if it is in included in the pipeline.", + help="Force removal of the module, even if it is included in the pipeline.", ) def command_modules_remove(ctx, directory, tool, force): """ From a6a9315bf8ba5b11920c3268b1388e0b8b201abe Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 23 Apr 2026 15:09:03 +0200 Subject: [PATCH 5/6] fix remove info message --- nf_core/components/remove.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nf_core/components/remove.py b/nf_core/components/remove.py index 08f0548882..1d34024920 100644 --- a/nf_core/components/remove.py +++ b/nf_core/components/remove.py @@ -181,8 +181,9 @@ def remove(self, component, repo_url=None, repo_path=None, removed_by=None, remo if dependency_removed: removed_components.append(component_name.replace("/", "_")) # print removed dependencies - if removed_components: - log.info(f"Removed files for '{component}' and its dependencies '{', '.join(removed_components)}'.") + dependencies = set(removed_components) - {component} + if dependencies: + log.info(f"Removed files for '{component}' and its dependencies '{', '.join(dependencies)}'.") else: log.info(f"Removed files for '{component}'.") else: From ae7e1503d5e61a5b62419507d2218eb01974b68f Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 23 Apr 2026 15:11:44 +0200 Subject: [PATCH 6/6] fix same typo again --- nf_core/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 0a470edcea..f115bf2bfa 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1801,7 +1801,7 @@ def subworkflows_patch(ctx, subworkflow, directory, remove): "--force", is_flag=True, default=False, - help="Force removal of the subworkflow, even if it is in included in the pipeline.", + help="Force removal of the subworkflow, even if it is included in the pipeline.", ) def command_subworkflows_remove(ctx, directory, subworkflow, force): """