skills/latchbio-integration/references/nextflow-snakemake.md
Latch supports Python, Nextflow, and Snakemake workflows, but their packaging paths are not interchangeable. Confirm the SDK version and choose one track before generating files.
nextflow_schema.jsonInstall:
uv pip install "latch==2.76.8"
latch generate-metadata nextflow_schema.json --nextflow
Current generation creates:
latch_metadata/
├── __init__.py
└── generated.py
generated.py is regenerated from the schema. Do not edit it.latch_metadata/__init__.py.nextflow_schema.json.SDK 2.67.0 changed Nextflow generation to use one generated dataclass containing
all parameters and a generated base flow. Older parameters.py examples may no
longer match the generated layout.
The currently documented wrapper command is:
latch login
latch register . \
--nf-script main.nf \
--nf-execution-profile docker,test
Registration generates a Latch workflow wrapper and latch.config. The exact
entrypoint location depends on the generation path and SDK version.
Important:
Dockerfile exists, registration uses it..latch/.--nf-script again can regenerate and overwrite wrapper code.--nf-script to preserve it.SDK 2.76.8 also exposes:
latch nextflow generate-entrypoint . \
--nf-script main.nf \
--execution-profile docker,test \
--output wf/custom_entrypoint.py
This requires a valid NextflowMetadata object in the metadata root.
The CLI also has:
latch nextflow register . --script-path main.nf
The official CLI guide marks this command experimental and only applicable
to Forch, Latch's architecture for running Nextflow in the user's own AWS
account. It is not a general alternative to latch register --nf-script.
Use it only for a configured Forch/BYOC project with current Latch guidance.
latch.config in the effective config chain.NextflowRuntimeResources.storage_gib for the runtime/shared filesystem,
not just final outputs.storage_expiration_hours.latch register --staging .
latch develop .
latch nextflow attach --execution-id <execution-id>
Within latch develop, the production storage initializer is unavailable.
Follow the official debug-mode guidance: use the local executor, bypass the
initializer in debug mode, use a compatible Latch Nextflow base image, and
reduce process resources.
The current docs and current stable package expose different Snakemake tracks. Do not mix them.
The 2.76.8 wheel still exposes the snakemake extra, legacy metadata classes,
generate-metadata --snakemake, and register --snakefile. However, the
official CLI guide marks the Snakemake metadata and registration flags
deprecated and says metadata generation no longer works for
latch >= 2.55.0.a6.
Treat this as an unresolved source/documentation conflict. The commands below are useful when maintaining a legacy project already known to use this path, but should not be presented as a supported new-project flow without confirming with current Latch documentation or support.
Use Python 3.11 for the broadest compatibility with the pinned Snakemake 7.x dependency:
uv venv --python 3.11
source .venv/bin/activate
uv pip install "latch[snakemake]==2.76.8"
Generate metadata from the workflow config:
latch generate-metadata config.yaml --snakemake
Register:
latch register . --snakefile Snakefile
Relevant options:
latch register . \
--snakefile Snakefile \
--metadata-root latch_metadata \
--cache-tasks
Use the current SnakemakeMetadata, SnakemakeParameter, FileMetadata,
EnvironmentConfig, and DockerMetadata APIs from latch.types.metadata.
Inspect their signatures before generating hand-written metadata.
The current Snakemake v2 tutorial is a compatibility-specific path. At the time of this refresh, it explicitly requires:
uv venv --python 3.11
source .venv/bin/activate
uv pip install "latch==2.62.1a2"
It uses imports such as:
from latch.types.metadata.snakemake_v2 import SnakemakeV2Metadata
and commands such as:
latch snakemake generate-entrypoint .
latch dockerfile --snakemake -c environment.yaml . -f
latch register -y .
Those v2 metadata modules and the latch snakemake command group are not
present in the stable 2.76.8 source tree. The tutorial's generated Dockerfile
also pins the workflow runtime separately to
latch[snakemake]==2.55.0.a6.
Therefore:
profiles/default/config.yaml.LatchOutputDir for output destinations exposed in the form.environment.yaml, Dockerfiles, profiles, or
generated metadata.Before editing a generated file: