In order to generate the interface for your workflow on Latch, you need to specify which parameters you want to expose - and how you want to expose them - in a latch_metadata package.

In your workflow directory, create a folder called latch_metadata, and in it, add a file called __init__.py. The content of the file should look like this:

from dataclasses import dataclass
from typing import List

from latch.types.directory import LatchDir, LatchOutputDir
from latch.types.file import LatchFile
from latch.types.metadata.latch import LatchAuthor
from latch.types.metadata.snakemake import SnakemakeParameter
from latch.types.metadata.snakemake_v2 import SnakemakeV2Metadata


@dataclass
class Sample:
    name: str
    r1: LatchFile
    r2: LatchFile


metadata = SnakemakeV2Metadata(
    display_name="Test Workflow",
    author=LatchAuthor(),
    parameters={
        "samples": SnakemakeParameter(
            display_name="Samples",
            type=List[Sample],
            samplesheet=True,
        ),
        "results_dir": SnakemakeParameter(
            display_name="Results Dir",
            type=LatchOutputDir,
            default=LatchDir("latch://123.account/results"),
        ),
    },
)

The only hard requirements for this file is that it create a SnakemakeV2Metadata object and define an appropriate set of parameters using SnakemakeParameter objects. SnakemakeParameters are identical to LatchParameters, with an additional required type field.

Values passed through the interface will be marshalled into JSON and then provided to your workflow as an external config file. For example, in the above workflow, if we pass a single Sample called test with r1 at latch://123.account/test_r1.fastq and r2 at latch://123.account/test_r2.fastq, the resulting config file would look like

{
    "samples": [
        {
            "name": "test",
            "r1": "/ldata/123.account/test_r1.fastq",
            "r2": "/ldata/123.account/test_r2.fastq"
        }
    ],
    "results_dir": "latch://123.account/results"
}

These can then be accessed from within the Snakemake workflow via the config object, e.g. config["samples"][0] would get the first sample. See encoding for more info.