Skip to content

Module system#6650

Merged
pditommaso merged 84 commits intomasterfrom
251117-module-system
Mar 17, 2026
Merged

Module system#6650
pditommaso merged 84 commits intomasterfrom
251117-module-system

Conversation

@pditommaso
Copy link
Copy Markdown
Member

@pditommaso pditommaso commented Dec 11, 2025

Summary

Full implementation of the Nextflow Module System, enabling first-class support for installing, managing, publishing, and running modules from a centralized registry.

Main capabilities

CLI commands (nextflow module <subcommand>)

  • module install — Download and install a module from the registry to the local modules/ directory with checksum validation and integrity tracking. Supports -version and -force flags.
  • module run — Execute a module directly from the registry without pre-installing. Auto-installs if needed, then delegates to the standard run command.
  • module list — List all locally installed modules with version and integrity status (OK / MODIFIED / LOCAL / CORRUPTED). Supports table or JSON output.
  • module remove — Remove installed modules with integrity checks to prevent accidental data loss. Supports -force and -keep-files flags.
  • module search — Query the registry for modules matching a search term. Returns formatted results or JSON with metadata and relevance scores.
  • module info — Display detailed module metadata including description, authors, tools, input/output parameter schema, and usage command templates. Smart parameter inference for nf-core modules.
  • module publish — Publish a local module to the registry. Validates structure (requires main.nf, meta.yml, README.md), enforces size limits, bundles as tar.gz, computes checksum, and uploads via authenticated API. Supports -dry-run.

Registry client (ModuleRegistryClient)

REST API client with built-in retry logic and multi-registry fallback:

  • Fetch module metadata and specific release details
  • Download module bundles with SHA-256 integrity validation
  • Search modules by keyword
  • Publish module bundles (authenticated via NXF_REGISTRY_TOKEN or config)

Local storage management (ModuleStorage)

File-based storage in modules/scope/name/ with .module-info marker files:

  • Install/extract downloaded bundles with checksum tracking
  • Detect local modifications via integrity checking
  • Create tar.gz bundles for publishing (excluding internal metadata)
  • Atomic operations with cleanup on failure

Module resolution (ModuleResolver)

Coordinates between registry and local storage:

  • Resolve module references to local paths with auto-install
  • Version validation and auto-upgrade on mismatch
  • Integrity warnings for locally modified modules

DSL integration

New syntax for remote module inclusion:

include { myWorkflow } from 'scope/name'
include { myProcess } from 'scope/name@1.2.0'

Pluggable resolution via RemoteModuleResolver SPI, allowing third-party registries.

Configuration (registry scope)

registry {
    url = 'https://registry.nextflow.io/api'
    apiKey = '...'  // or NXF_REGISTRY_TOKEN env var
}

Supports multiple registries with fallback.

Data models

  • ModuleReference — Parses and validates scope/name format
  • ModuleSpec — YAML parser for meta.yml with validation (name, version, description, license)
  • InstalledModule — Tracks installed state, version, checksum, and integrity status
  • ModuleChecksum — SHA-256 directory checksums for integrity verification

Security

  • Archive integrity validation and zip-slip prevention
  • Bundle size limits (1MB)
  • Checksum verification on download

Documentation and design

  • ADR documenting the full specification (adr/20251114-module-system.md)
  • CLI reference docs (docs/cli.md, docs/reference/cli.md)
  • Module user guide (docs/module.md)
  • Implementation specs and registry API contract (specs/251117-module-system/)

Testing

Comprehensive Spock test coverage for all components (~4,000 lines of tests):

  • All 7 CLI subcommands
  • Registry client, storage, resolver, checksum, spec parsing
  • Module reference validation and include definition integration

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 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Dec 11, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 34426ea
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/69b83bad90ac8f00084d7c01

pditommaso and others added 6 commits December 11, 2025 16:22
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
- 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 <paolo.ditommaso@gmail.com>
- 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 <paolo.ditommaso@gmail.com>

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
- 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 <paolo.ditommaso@gmail.com>
@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
Copy Markdown
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 thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md
Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
pditommaso and others added 6 commits January 7, 2026 22:59
Co-authored-by: Jorge Ejarque <jorgee@users.noreply.github.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Jorge Ejarque <jorgee@users.noreply.github.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Co-authored-by: Jorge Ejarque <jorgee@users.noreply.github.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
Expand deprecation notice to cover all ext.* custom directives

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
- 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 <paolo.ditommaso@gmail.com>
Remove @ prefix from scope in API path to match API definition

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso pditommaso requested review from a team as code owners March 3, 2026 10:09
jorgee and others added 2 commits March 4, 2026 16:20
…m [ci skip]

Signed-off-by: jorgee <jorge.ejarque@seqera.io>
…from module scopes, remove version pinning from `nextflow.config`

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman bentsherman dismissed their stale review March 10, 2026 01:58

Comments resolved

Signed-off-by: jorgee <jorge.ejarque@seqera.io>
@bentsherman bentsherman changed the title ADR: Nextflow Module System Module system Mar 10, 2026
@bentsherman bentsherman mentioned this pull request Mar 10, 2026
5 tasks
Comment thread docs/reference/cli.md Outdated
Comment thread docs/cli.md Outdated
Comment thread adr/20251114-module-system.md Outdated
var includeUri = getIncludeUri(uri, source);

var isRemoteModule = ModuleResolver.isRemoteModule(source);
var parent = isRemoteModule ? Path.of("modules") : Path.of(uri).getParent();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This will probably not work for the language server, since the language server can manage multiple workspaces at once. I will need to pass a workspace root into this visitor.

I will look into this separately, no need to block this PR

bentsherman and others added 9 commits March 13, 2026 17:09
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: jorgee <jorge.ejarque@seqera.io>
… contains the .module-info. This folders can't be a module

Signed-off-by: jorgee <jorge.ejarque@seqera.io>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Copy link
Copy Markdown
Member

@bentsherman bentsherman left a comment

Choose a reason for hiding this comment

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

@christopher-hakkaart we should follow up on the module docs later. It seems like we are duplicating some info between the CLI page and Modules page, could likely be improved

Comment thread adr/20251114-module-system.md Outdated
Comment thread adr/20251114-module-system.md Outdated
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@pditommaso pditommaso merged commit a0ac594 into master Mar 17, 2026
6 checks passed
@pditommaso pditommaso deleted the 251117-module-system branch March 17, 2026 09:34
@christopher-hakkaart
Copy link
Copy Markdown
Collaborator

Thanks @bentsherman - will check out the docs today

pditommaso added a commit that referenced this pull request Mar 17, 2026
Revert condition from `!decoded.plugins` to `decoded.plugins == null`
to avoid throwing an exception when the registry returns an empty list.
In Groovy, an empty list is falsy, so the previous check incorrectly
treated a valid empty response as a parse failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
pditommaso added a commit that referenced this pull request Mar 17, 2026
Revert condition from `!decoded.plugins` to `decoded.plugins == null`
to avoid throwing an exception when the registry returns an empty list.
In Groovy, an empty list is falsy, so the previous check incorrectly
treated a valid empty response as a parse failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@bentsherman bentsherman linked an issue Apr 8, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nextflow modules command to install remote modules