Conversation
Introduces specification for typed tool arguments in module definitions: - Extend tools section in meta.yaml with args component - Argument attributes: type, enum, prefix, default, description - Script usage via tools implicit variable - Configuration and CLI override mechanisms - Migration guide from ext.args pattern Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
|
The typed validation and IDE support would be really nice for common options. However, the rationale behind
This means users can pass any tool option without waiting for it to be enumerated, and enables patterns like dynamic closures and sample-specific args: // Parameter-dependent
ext.args = { params.fastqc_kmer_size ? "-k ${params.fastqc_kmer_size}" : '' }
// Sample-specific
ext.args = { "--id ${meta.id}" }My concern is how we match this flexibility without either:
I noticed the earlier module-system ADR had this language: "This list does not need to be exhaustive. It should include any arguments known to be used by pipelines or that could be expected to be used by users." - but this ADR doesn't clarify what happens with unlisted options. Could we take a def func(a, b, **kwargs):
# a and b are typed/documented
# kwargs catches everything elseSimilarly: tools.bwa.args.K = 100000000 // documented in meta.yaml → validated
tools.bwa.args.B = 3 // not in meta.yaml → passed through as-isThe challenge is command-line formatting - documented args have
Option 2 is cleaner in terms of explicit expectations, but it's essentially |
|
Do we need the tools:
- bwa:
args:
"-K":
type: integertools.bwa.args['-K'] = 3 I like the simplicity of that. Then in the module we just do |
|
It might be enough to just have The tool spec could just be a list of argument descriptions. Using nf-core/bwa/mem as an example: tools:
- bwa:
documentation: https://bio-bwa.sourceforge.net/bwa.shtml
args:
- shortName: '-t'
longName: '--threads' # bwa mem doesn't actually have long option names, this is just to illustrate
type: integer
default: 1
description: 'Number of threads'
- shortName: '-k'
type: integer
default: 19
description: 'Minimum seed length'
# ...So, users and agents would still construct the desired string of args, but could use the tool spec for guidance. No need for an additional layer of typed parameters, which might introduce more rough edges Note that nf-core/bwa/mem already has a documentation URL, which just provides the man-page for bwa. So in this case, an agent might not even need the tool spec if it can just consult the tool documentation. But other tools might not be as well documented, and either way it can be nice to have the most useful options documented locally |
|
Agree on both last comment. We could explicitly only target GNU CLI conventions, and infer Agree, also the list should not be exhaustive, it's meant to expose the tool options that can be used to parametrise the process execution. What I dislike in the current for is the "subcommand argument collision"
|
|
From our discussion today, people seem to like the prospect of specifying args with a map. Phil's example using the literal option name seems like the safest approach: tools:
- bwa:
args:
"-K":
type: integertools.bwa.args['-K'] = 3 With a method like Some challenges that came up:
|
|
The |
Summary
Introduces ADR for typed tool arguments in module definitions, replacing the convoluted
task.ext.argspattern.Problem: Current
ext.argsapproach uses opaque strings with no validation, documentation, or IDE support.Solution: Extend
toolssection inmeta.yamlwith typedargscomponent:Key features:
${tools.bwa.args}for all args,${tools.bwa.args.K}for singletools.bwa.args.K = 100000000--tools.bwa.K=valueOpen problems:
Related
adr/20251114-module-system.mdadr/20260128-module-parameters.md🤖 Generated with Claude Code