Skip to content

Conversation

@pditommaso
Copy link
Member

@pditommaso pditommaso commented Dec 11, 2025

Summary

Architecture Decision Record (ADR) for the Nextflow Module System, documenting:

  • Remote module inclusion via registry with @scope/name syntax
  • Semantic versioning with dependency resolution
  • Unified Nextflow Registry (rebrand existing plugin registry)
  • First-class CLI support (pull, push, search, run)
  • Module metadata schema (meta.yaml) with JSON Schema validation
  • Structured tool arguments replacing ext.args pattern

Key Files

  • adr/20251114-module-system.md - Main ADR document with full specification
  • adr/module-spec-schema.json - JSON Schema for meta.yaml validation

Updates

Version 2.2 (2025-01-06)

  • Structured tool arguments: Added args property to tools section for type-safe argument configuration
  • New implicit variables: tools.<toolname>.args.<argname> returns formatted flag+value; tools.<toolname>.args returns all args concatenated
  • Deprecation: ext.args, ext.args2, ext.args3 pattern deprecated in favor of structured tool arguments

Version 2.1 (2025-12-11)

  • Unified dependencies: Consolidated components, dependencies, and requires into single requires field
  • New sub-properties: requires.modules and requires.workflows for declaring module dependencies
  • Unified version syntax: [scope/]name[@constraint] format across plugins, modules, and workflows
  • Deprecation: components field deprecated (use requires.modules instead)

Test plan

  • Review ADR document for completeness and clarity
  • Validate JSON Schema against example meta.yaml files
  • Review tool arguments specification for nf-core compatibility
  • Validate design decisions align with ecosystem needs

🤖 Generated with Claude Code

pditommaso and others added 4 commits November 17, 2025 15:09
Introduce comprehensive development constitution documenting core principles
and practices for Nextflow development including modular architecture,
test-driven quality assurance, dataflow programming model, licensing
compliance, DCO requirements, semantic versioning, and Groovy code standards.

The constitution codifies existing best practices from CLAUDE.md and
CONTRIBUTING.md to provide clear governance and quality standards for
the project.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
@netlify
Copy link

netlify bot commented Dec 11, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 68b202f
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/69690cda0b4b1800098c088a

pditommaso and others added 6 commits December 11, 2025 16:22
- Add comprehensive documentation for all module CLI commands
- Add `nextflow module run` command for standalone module execution
- Remove `module update` command to simplify the design
- Use single-dash prefix for Nextflow options, double-dash for module inputs
- Remove @ prefix from scope in CLI commands (keep only in DSL syntax)

Signed-off-by: Paolo Di Tommaso <[email protected]>
- Remove separate `dependencies` and `components` fields
- Expand `requires` to include:
  - `nextflow`: version constraint (unchanged)
  - `plugins`: array with name@constraint syntax
  - `modules`: array of module dependencies
  - `workflows`: array of workflow dependencies
- Unified version constraint syntax: `[scope/]name[@constraint]`
- Mark `components` as deprecated (use requires.modules)
- Update all examples in ADR and schema

Signed-off-by: Paolo Di Tommaso <[email protected]>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
- Add `args` property to tools section for type-safe argument configuration
- Define toolArgSpec with flag, type, description, default, enum, required
- Support implicit variable `tools.<toolname>.args.<argname>` returning
  formatted flag+value (e.g., "-K 100000000")
- Support `tools.<toolname>.args` to return all args concatenated
- Document deprecation of ext.args/ext.args2/ext.args3 pattern
- Update ADR with Tool Arguments Configuration section and appendix

[ci skip]

Signed-off-by: Paolo Di Tommaso <[email protected]>
@pditommaso pditommaso force-pushed the 251117-module-system branch from c956ca7 to 01c777a Compare January 6, 2026 12:07
@pditommaso pditommaso marked this pull request as ready for review January 6, 2026 12:09
@bentsherman
Copy link
Member

The module spec schema will be defined in the nextflow-io/schemas repo. Here is the PR for it: nextflow-io/schemas#10

Comment on lines +39 to +48
### 1. Remote Module Inclusion

**DSL Syntax**:
```groovy
// Import from registry (scoped module name, detected by @scope prefix)
include { BWA_ALIGN } from '@nf-core/bwa-align'

// Existing file-based includes remain supported
include { MY_PROCESS } from './modules/my-process.nf'
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be out-of-scope for the first iteration. Let's focus on the modules command and module spec generation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I have understood correctly, at parse time @nf-core/bwa-align will be translated to modules/@scope/name@version/main.nf.
If it is not supported in first iteration, users must write the include statements providing the module path taking into account the version and keep the coherence of these include statements with the versions of nextflow.config.
I think it is also required for defining modules importing other modules. If this is not supported, modules must be written using include with paths.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, likely module versioning would also be out of scope. The primary motivation initially was to allow remote module execution:

nextflow module run @nf-core/bwa-align

This can be done without remote module inclusion. We can probably still implement module versioning just for installing and executing modules

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to delay module versioning, there's already an initial implementation for the registry backend


**Resolution Timing**: Modules resolved at workflow parse time (after plugin resolution at startup).

**Local Storage**: Downloaded modules stored in `modules/@scope/name@version/` directory in project root (not global cache). Each module must contain a `main.nf` file as the required entry point. It is intended that module source code will be committed to the pipeline git repository.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There could be cases where the version in cached modules does not match the nextflow.config (e.g users upgrade the module in config but do not commit the module's files)
What should it do in these cases? warn the user and download the new version or fail?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely it should be added a command to detect/solve these kind of inconsistency but I would avoid warning too verbosely

2. Downloads the module archive from the registry
3. Extracts to `modules/@scope/name@version/` directory
4. Recursively installs transitive dependencies declared in `meta.yaml`
5. Updates `nextflow.config` if installing a new module not already configured
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it also include the installed transitive dependencies in nexflow.config, or just the module requested to install.

c. If not found locally: query registry for latest version
d. Warn if module not pinned in config (especially transitive dependencies)
3. Download missing modules to `modules/@scope/name@version/`
4. Read module's `meta.yaml` → resolve transitive dependencies recursively
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modules meta includes required Nextflow version and plugins. At this point, I think it should validate the required nextflow version and the required plugins (loading them if missing)

pditommaso and others added 6 commits January 7, 2026 22:59
Co-authored-by: Jorge Ejarque <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-authored-by: Jorge Ejarque <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Co-authored-by: Jorge Ejarque <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
Expand deprecation notice to cover all ext.* custom directives

Signed-off-by: Paolo Di Tommaso <[email protected]>
- Use consistent module path format with version: modules/@scope/name@version/
- Fix directory structure example: samtools-view -> samtools/view
- Standardize on 'license' spelling (American English)
- Fix author -> authors (plural array format)

Signed-off-by: Paolo Di Tommaso <[email protected]>
Remove @ prefix from scope in API path to match API definition

Signed-off-by: Paolo Di Tommaso <[email protected]>
- Update API endpoints to match seqeralabs/plugin-registry#266
- Use /api/modules base path (no v1 prefix)
- Use single {name} parameter with namespace (e.g., "nf-core/fastqc")
- Add separate /releases endpoint
- Simplify publish to single POST endpoint

Signed-off-by: Paolo Di Tommaso <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
- Remove checksums from nextflow.config (registry is source of truth)
- Use single version per module locally (no version in directory path)
- Add .checksum file in module directory for integrity verification
- Simplify freeze command to only pin transitive dependency versions
- Checksum mismatch reports warning instead of automatic re-download
- Remove resolved open question about checksum verification

Signed-off-by: Paolo Di Tommaso <[email protected]>
@pditommaso
Copy link
Member Author

Summary of Recent Changes

Major Simplification: Module Storage and Verification Model

The module system has been significantly simplified by making the registry the source of truth for checksums:

Config Syntax Simplified - Removed checksums from config, version-only format:

modules {
    '@nf-core/salmon' = '1.1.0'
    '@nf-core/bwa-align' = '1.2.0'
}

Local Storage Structure - Single version per module (no version in path), with .checksum file for integrity verification:

modules/
└── @nf-core/
    └── bwa-align/
        ├── .checksum           # Cached registry checksum for fast validation
        ├── meta.yaml
        └── main.nf

Verification Flow:

  1. Install: Download module → store .checksum from registry's X-Checksum header
  2. On run: Compute local checksum → compare with .checksum
  3. Match → proceed (no registry call needed)
  4. Mismatch → report warning (user must explicitly reinstall)

freeze Command Simplified - Only pins versions, no checksums in config

Other Updates

  • Module API updated to match actual registry implementation (/api/modules/{name} pattern)
  • Tool Arguments CLI support added: --tools:<tool>:<arg> <value> syntax
  • Open Questions section added for pending design decisions
  • Terminology standardized: "Nextflow registry" instead of "plugin registry"
  • Various fixes: consistent sha256: prefix, license spelling, authors plural form, path formats

pditommaso and others added 7 commits January 15, 2026 10:58
Co-authored-by: Jorge Ejarque <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
…tions [ci skip]

- Added Resolution Rules table clearly specifying behavior for each scenario:
  - Version change (local unmodified): automatically replace with declared version
  - Local modification (checksum mismatch): warn and protect local changes
  - Use -force flag to override locally modified modules
- Updated install command behavior to reflect checksum verification
- Updated Technical Details with expanded resolution flow

Signed-off-by: Paolo Di Tommaso <[email protected]>
…skip]

- Fixed Resolution Rules table: locally modified modules will NOT be
  replaced unless -force is used (was incorrectly saying "will be replaced")
- Added Version 2.3 changelog entry documenting:
  - Resolution Rules table with clear behavior matrix
  - Local modification protection with -force flag
  - Simplified storage model (single version per module)
  - .checksum file for fast integrity verification

Signed-off-by: Paolo Di Tommaso <[email protected]>
Specification for Nextflow module system client implementation based on
ADR 20251114-module-system.md. Covers:

P1 (Core):
- Install and use registry modules via @scope/name syntax
- Run modules directly from CLI without wrapper workflow
- Structured tool arguments replacing ext.args pattern

P2 (Important):
- Module version management and freeze command
- Module integrity protection with checksum validation

P3 (Nice to have):
- Remove module command
- Search and discover modules
- Publish module to registry

Registry backend is out of scope (assumed implemented).

Signed-off-by: Paolo Di Tommaso <[email protected]>
- Remove `freeze` command from CLI
- Remove transitive dependency install behavior
- Remove orphaned transitive dependency removal from `remove` command
- Update rationale and consequences sections
- Simplify dependency resolution flow
- Update ADR to version 2.4

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Signed-off-by: Paolo Di Tommaso <[email protected]>
@pditommaso
Copy link
Member Author

Version 2.4 Changes

Updated the ADR to remove transitive dependency resolution from the initial implementation scope. This simplifies the module system by requiring explicit dependency declarations.

Summary of Changes

  • Removed freeze command from CLI - no longer needed without transitive dependency management
  • Simplified install behavior - removed automatic recursive installation of transitive dependencies
  • Updated remove command - removed orphaned transitive dependency cleanup
  • Simplified dependency resolution flow - modules are resolved directly from nextflow.config declarations only
  • Updated rationale and consequences sections to reflect the simplified model

Rationale

Transitive dependency resolution adds significant complexity and will not be implemented in this initial stage. Each module's dependencies must be explicitly declared in nextflow.config, giving users full control and visibility over what modules are installed.

This change also affects the spec at specs/251117-module-system/spec.md which was updated to remove:

  • Transitive dependency acceptance scenarios
  • FR-010, FR-011 (transitive dependency requirements)
  • freeze command from FR-019
  • SC-008 (transitive dependencies success criteria)

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.

4 participants