-
Notifications
You must be signed in to change notification settings - Fork 784
docs: Restructure modules as a section and add registry steps #7030
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bentsherman
merged 17 commits into
nextflow-io:master
from
christopher-hakkaart:docs-modules-guide
Apr 23, 2026
Merged
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
9a823e2
Revise Modules pages and create new section
christopher-hakkaart 7e73921
Improve overview page
christopher-hakkaart c79c257
Add more details
christopher-hakkaart 6d02920
Make reference cli page consistent
christopher-hakkaart da203aa
Small fix
christopher-hakkaart f98511f
Check commands
christopher-hakkaart fd8867b
Tidy docs
christopher-hakkaart 4362e9f
Merge branch 'master' into docs-modules-guide
christopher-hakkaart e9f9551
Merge branch 'master' into docs-modules-guide
bentsherman 650a7f4
Merge branch 'master' into docs-modules-guide
bentsherman af89f81
Update links
bentsherman ba8002d
Trim examples in command reference
bentsherman 21999e2
Incorporate old module docs into new module docs
bentsherman fb43f80
Remove extraneous content in CLI usage docs
bentsherman f386927
Add redirect for old module page
bentsherman 03862ed
Fix links to module subcommands
bentsherman b112542
Apply suggestions from review
bentsherman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| (dev-modules-page)= | ||
|
|
||
| # Developing modules | ||
|
|
||
| Learn how to create modules for sharing through the Nextflow module registry. | ||
| For information about modules syntax, see {ref}`module-page`. | ||
|
|
||
| (dev-modules-creating)= | ||
|
|
||
| ## Creating a module | ||
|
|
||
| Use the `module create` command to scaffold a new module with the required files: | ||
|
|
||
| ```console | ||
| $ nextflow module create myorg/my-module | ||
| ``` | ||
|
|
||
| If you omit the name, the command prompts you for details: | ||
|
|
||
| ```console | ||
| $ nextflow module create | ||
| ``` | ||
|
|
||
| The command creates a module directory with the following files: | ||
|
|
||
| - `main.nf`: The module script containing your process definition. | ||
| - `meta.yml`: The module spec describing metadata, inputs, and outputs. | ||
| - `README.md`: Documentation for the module. | ||
|
|
||
| See {ref}`cli-module-create` for the full command reference. | ||
|
|
||
| (dev-modules-structure)= | ||
|
|
||
| ## Module structure | ||
|
|
||
| Registry modules follow a standard directory structure: | ||
|
|
||
| ``` | ||
| modules/ | ||
| └── myorg/ | ||
| └── my-module/ | ||
| ├── .module-info # Integrity checksum (generated at install/creation) | ||
| ├── README.md # Documentation (required for publishing) | ||
| ├── main.nf # Module script (required) | ||
| ├── meta.yml # Module spec (required for publishing) | ||
| ├── resources/ # Optional: module binaries and resources | ||
| └── templates/ # Optional: process templates | ||
| ``` | ||
|
|
||
| ### main.nf | ||
|
|
||
| The `main.nf` file contains the process (or workflow/function) definition. For example, a simple module wrapping FastQC: | ||
|
|
||
| ```nextflow | ||
| process FASTQC { | ||
| tag "$meta.id" | ||
| label 'process_medium' | ||
|
|
||
| conda 'bioconda::fastqc=0.12.1' | ||
| container "${ workflow.containerEngine == 'singularity' | ||
| ? 'https://depot.galaxyproject.org/singularity/fastqc:0.12.1--hdfd78af_0' | ||
| : 'biocontainers/fastqc:0.12.1--hdfd78af_0' }" | ||
|
|
||
| input: | ||
| tuple val(meta), path(reads) | ||
|
|
||
| output: | ||
| tuple val(meta), path("*.html"), emit: html | ||
| tuple val(meta), path("*.zip") , emit: zip | ||
|
|
||
| script: | ||
| """ | ||
| fastqc $reads --threads $task.cpus | ||
| """ | ||
| } | ||
| ``` | ||
|
|
||
| ### meta.yml | ||
|
|
||
| The `meta.yml` file describes the module's metadata, including its name, version, description, authors, and input/output specifications. Publishing requires this file, and the registry uses it to display module information and generate usage templates. | ||
|
|
||
| ### README.md | ||
|
|
||
| The `README.md` file provides documentation for the module. It should describe what the module does, the tools it wraps, and any configuration requirements. | ||
|
|
||
| ### templates | ||
|
|
||
| Include process script {ref}`templates <process-template>` alongside a module in the `templates/` directory. | ||
| See {ref}`module-templates` for details. | ||
|
|
||
| ### resources | ||
|
|
||
| Modules can include binary scripts in the `resources/usr/bin/` directory that are locally scoped to the module's processes. See {ref}`module-binaries` for details. | ||
|
|
||
| (dev-modules-spec)= | ||
|
|
||
| ## Generating a module spec | ||
|
|
||
| Use the `module spec` command to generate or update the `meta.yml` file from the module's `main.nf`: | ||
|
|
||
| ```console | ||
| $ nextflow module spec myorg/my-module | ||
| ``` | ||
|
|
||
| Provide metadata fields directly to avoid `TODO` placeholders in the generated file: | ||
|
|
||
| ```console | ||
| $ nextflow module spec \ | ||
| -namespace myorg \ | ||
| -version 1.0.0 \ | ||
| -description "Quality control of raw sequencing reads" \ | ||
| -license MIT \ | ||
| -author "@myname" \ | ||
| ./modules/myorg/my-module | ||
| ``` | ||
|
|
||
| Use `-dry-run` to preview the generated spec without writing to disk: | ||
|
|
||
| ```console | ||
| $ nextflow module spec -dry-run myorg/my-module | ||
| ``` | ||
|
|
||
| If a `meta.yml` already exists, the command incorporates its content into the new file. | ||
|
|
||
| See {ref}`cli-module-spec` for the full command reference. | ||
|
|
||
| (dev-modules-validate)= | ||
|
|
||
| ## Validating a module | ||
|
|
||
| Use the `module validate` command to check that a module is ready for publishing: | ||
|
|
||
| ```console | ||
| $ nextflow module validate myorg/my-module | ||
| ``` | ||
|
|
||
| The command verifies that: | ||
|
|
||
| - All required files are present (`main.nf`, `meta.yml`, `README.md`). | ||
| - The module spec contains all required fields (name, version, description, and license). | ||
|
|
||
| See {ref}`cli-module-validate` for the full command reference. | ||
|
|
||
| (dev-modules-testing)= | ||
|
|
||
| ## Testing a module | ||
|
|
||
| Before publishing, test your module by running it directly: | ||
|
|
||
| ```console | ||
| $ nextflow module run myorg/my-module --input 'test-data/*.fastq.gz' | ||
| ``` | ||
|
|
||
| The command executes the module as a standalone workflow, allowing you to verify that inputs are correctly declared, the process runs successfully, and outputs appear as expected. | ||
|
|
||
| For more thorough testing, create a small wrapper workflow that exercises the module: | ||
|
|
||
| ```nextflow | ||
| include { MY_MODULE } from './modules/myorg/my-module' | ||
|
|
||
| workflow { | ||
| input_ch = Channel.fromFilePairs('test-data/*_{1,2}.fastq.gz') | ||
| MY_MODULE(input_ch) | ||
| MY_MODULE.out.results.view() | ||
| } | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.