Skip to content

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

Merged
mashehu merged 3 commits into
nf-core:devfrom
asharaali:fix-4452-container-formatting
Oct 15, 2026
Merged

mashehu merged 3 commits 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

@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
Member

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

@mashehu
mashehu force-pushed the fix-4452-container-formatting branch from 673df6b to a66641d Compare October 2, 2026 11:54
@mashehu
mashehu force-pushed the fix-4452-container-formatting branch from 5d81124 to 5883607 Compare October 9, 2026 14:46
@mashehu

mashehu commented Oct 9, 2026

Copy link
Copy Markdown
Member

@nf-core-bot changelog

@mashehu
mashehu force-pushed the fix-4452-container-formatting branch from 474b150 to 8ec243d Compare October 15, 2026 15:11
@mashehu
mashehu enabled auto-merge (squash) October 15, 2026 15:12
asharaali and others added 2 commits October 15, 2026 17:30
`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 8ec243d to a4816ce Compare October 15, 2026 15:30
@mashehu
mashehu disabled auto-merge October 15, 2026 15:31
Comment thread CHANGELOG.md Outdated
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.39%. Comparing base (fc17087) to head (40fb108).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mashehu
mashehu merged commit ef1d3c6 into nf-core:dev Oct 15, 2026
124 checks passed
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.

3 participants