Add manifest.diagram to the pipeline template, with linting - #4460
Conversation
Nextflow 26.10 adds `manifest.diagram`, a relative path to the pipeline's workflow diagram. Older versions ignore unknown manifest fields, so it is safe to set in any pipeline. The template ships the field commented out with a TODO, since a new pipeline has no metro map yet. Linting warns when it is missing and fails when it is set to a URL or to a path that does not exist in the repository. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Nextflow accepts image/svg+xml, image/png, image/jpeg, image/gif and image/webp, so fail on any other file extension. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
These jobs lint with `--fail-warned`, so the missing-diagram warning that a new pipeline is meant to get becomes a failure. Neutralise it the same way the workflows already handle the template TODOs and `includeConfig`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
| nextflowVersion = '!>=25.10.4' | ||
| version = '{{ version }}' | ||
| doi = '' | ||
| // TODO nf-core: Make a metro map (nf-metro or drawn) and add relative path to the SVG below |
There was a problem hiding this comment.
| // TODO nf-core: Make a metro map (nf-metro or drawn) and add relative path to the SVG below | |
| // TODO nf-core: Make a metro map and add relative path to the SVG below |
Don't think we need to push nf-metro in a comment ;-)
There was a problem hiding this comment.
I kind of disagree - we're pushing people to make a metro map, which is difficult. nf-metro makes it easy. So by pushing it we're helping people, who might otherwise not know it exists?
If you prefer we could link to the nf-core docs, and have more long form stuff there about different ways to make metro maps (including nf-metro), but I want to give some guidance rather than leaving people to assume that they need to buy a license for Adobe Illustrator..
| * Any SVG works, including hand-drawn ones. `nf-metro <https://seqeralabs.github.io/nf-metro/latest/>`_ | ||
| can generate one from a config file, if you'd like a hand. |
There was a problem hiding this comment.
| * Any SVG works, including hand-drawn ones. `nf-metro <https://seqeralabs.github.io/nf-metro/latest/>`_ | |
| can generate one from a config file, if you'd like a hand. | |
| * Any SVG works. |
|
This is what happens if you run a pipeline with this config setting in a version of Nextflow that doesn't support it: ❯ nextflow run ./demo --help
N E X T F L O W ~ version 26.04.6
Downloading plugin nf-schema@2.7.2
Launching `./demo/main.nf` [lonely_moriondo] revision: f6f57a9eb7
WARN: Unrecognized config option 'manifest.diagram'
------------------------------------------------------
,--./,-.
___ __ __ __ ___ /,-._.--~'
|\ | |__ __ / ` / \ |__) |__ } {
| \| | \__, \__/ | \ |___ \`-._,-`-,
`._,._,'
nf-core/demo 1.2.0
------------------------------------------------------With strict syntax off (old language parser) there's nothing at all: ❯ NXF_SYNTAX_PARSER=v1 nextflow run ./demo --help
N E X T F L O W ~ version 26.04.6
Launching `./demo/main.nf` [festering_rubens] revision: f6f57a9eb7
------------------------------------------------------
,--./,-.
___ __ __ __ ___ /,-._.--~'
|\ | |__ __ / ` / \ |__) |__ } {
| \| | \__, \__/ | \ |___ \`-._,-`-,
`._,._,'
nf-core/demo 1.2.0
------------------------------------------------------ |
|
Looks good on a wider sweep of Nextflow versions (was worried briefly, but turns out that the error I saw at first was because my version of Java was too new for the old Nextflow version) Stuff breaks badly if you try to access the config attribute within the pipeline (eg. All runs below on JDK 21 (JDK 17 for ≤23.04). Exit code 0 everywhere, workflow ran, no version failed.
|
|
Does this key support defining light-/dark-background images ? We generate all diagrams in both themes (same content, so could pick either) |
This did occur to me when I was writing that Nextflow PR, but I went with a single value proposition on the assumption that we could make SVGs that worked well enough in light and dark. |
To elaborate: SVGs can have CSS variable colours that detect the host operating system's light / dark mode. So you can have white text or black text according to that. nf-metro does this by default, I believe. We can write some docs on the concept too. It's not always super straightforward, eg. if a website's theme is set to light but the OS is dark, but generally it works pretty well. And it is possible to overcome this edge case if needed, with a bit of cleverness. Worst case, we can just chuck in a non-transparent background to the image and it should be safe everywhere. |
Hooray! CodSpeed harness just leveled up!The base and head of this comparison were measured with different runner settings, so their benchmark values are not directly comparable. What changed between base and head:
Re-run the base with the same settings to get a valid performance comparison. Comparing Footnotes |
Nextflow recently added
manifest.diagram: a relative path to the pipeline's workflow diagram. It lands in Nextflow 26.10. Older versions ignore unknown manifest fields, so it's safe to set in any pipeline today.Template
Adds the field to
nextflow.config, commented out with a TODO, since a brand new pipeline has no metro map yet:nf-metro is mentioned as a recommendation, not a requirement — any SVG works, however you make it.
Linting
Both checks live in the existing
nextflow_configlint test rather than a new one:manifest.diagramis not set. A freshly created pipeline gets this warning until the author draws a map, alongside the other template TODO warnings..svg,.png,.jpg,.jpeg,.gif,.webp), or points at a file that isn't in the repository.The lint docs are generated from the test's docstring, which is updated to cover both.
Since a new pipeline now always produces the missing-diagram warning, the existing
assert len(result["warned"]) == 0assertions intest_nextflow_config.pynow assert that this is the only warning. Four new tests cover the valid path, missing file, unsupported format and URL cases.CI
create-lint-wfandcreate-test-lint-wf-templatelint the generated test pipeline with--fail-warned, so the missing-diagram warning would fail those jobs. Both now create a placeholderdocs/images/metro_map.svgand uncomment thediagramline first, in the same way they already neutralise the template TODOs andincludeConfig.Pipelines themselves are unaffected: the template's
linting.ymldoesn't use--fail-warned, so authors get the nudge as a warning.Docs
The nf-core website side is in nf-core/website#4390 — a new section on the workflow schematics page.
PR checklist
CHANGELOG.mdis updateddocsis updated