Skip to content

modules bump-versions: match nf-core container formatting in main.nf - #4459

Open
asharaali wants to merge 1 commit into
nf-core:devfrom
asharaali:fix-4452-container-formatting
Open

modules bump-versions: match nf-core container formatting in main.nf#4459
asharaali wants to merge 1 commit into
nf-core:devfrom
asharaali:fix-4452-container-formatting

Conversation

@asharaali

Copy link
Copy Markdown

nf-core modules bump-versions rewrites the container directive in main.nf after the Wave build, and the block it writes puts the ternary operators at column 0 and pads the inside of ${...}:

    container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container
?         'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/e6/e613097.../data'
:         'community.wave.seqera.io/library/fgumi:0.6.0--c97194d17da0d1cd' }"

That is the shape nf-core/modules#12756 had to undo by hand across every bumped module.

Everywhere else in nf-core/modules, and in the modules this repo ships in nf_core/pipeline-template/modules/nf-core/{fastqc,multiqc}/main.nf, the directive reads:

    container "${workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container
        ? 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/e6/e613097.../data'
        : 'community.wave.seqera.io/library/fgumi:0.6.0--c97194d17da0d1cd'}"

update_main_nf_container() in nf_core/modules/containers.py builds the replacement from an f-string that emits ? {inner_indent} where it means {inner_indent}? . Moving the operators behind the indent and dropping the padding inside ${...} is the whole change.

Verification

tests/modules/test_containers.py does not run on my machine: TestModules.setUp builds a pipeline through nextflow config, and nextflow is not installed here. On unmodified dev all 38 tests in that file error out in setup, so a local pass/fail there would mean nothing either way — the new test is written for CI.

What I could check directly, by driving ModuleContainers.update_main_nf_container() against a temporary modules repo:

  • on dev, the rewritten directive is byte-identical to the broken block above
  • with this patch, it is byte-identical to modules/nf-core/samtools/sort/main.nf on nf-core/modules master

ruff check and ruff format --check are clean on both changed files.

CHANGELOG

Not touched. CHANGELOG.md has no running dev section since 4.1.0 shipped, and .github/workflows/changelog.py appends into one that already exists — happy for @nf-core-bot changelog to add the entry once there is a section to add it to, or to add it myself if you would rather pick the version heading now.

Fixes #4452

`nf-core modules bump-versions` rewrote the container directive with the
ternary operators at column 0 and padding inside `${...}`:

    container "${ workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container
    ?         'https://...'
    :         'quay.io/...' }"

Every module in nf-core/modules writes the operators at the start of the
indented continuation lines instead, with no padding:

    container "${workflow.containerEngine in ['singularity', 'apptainer'] && !task.ext.singularity_pull_docker_container
        ? 'https://...'
        : 'quay.io/...'}"

The cause is the order of the interpolations in `_replace`: `f"? {inner_indent}"`
emits the operator before the indent rather than after it.

This is the formatting undone by hand across 106 files in nf-core/modules#12756,
which is the PR the issue links to.

Adds a regression test asserting the canonical block is what lands in main.nf.

Closes nf-core#4452

Signed-off-by: Ashar Ali <aaa467@njit.edu>
@mashehu
mashehu force-pushed the fix-4452-container-formatting branch from 13c98c2 to 673df6b Compare September 1, 2026 19:38
@mashehu

mashehu commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

please join the nf-core org via slack to get the CI running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants