CLI reference #

The full command list below is generated from litmus itself.

Installation #

pip install litmus-test       # PyPI name is litmus-test; the import is `litmus`
litmus --help

After install, litmus is on $PATH.

Commands #

litmus benchmark {#cli-benchmark} #

Measure this machine's per-store performance.

Argument / optionTypeDescription
--fullflagRun the full sweep (100/1k/10k unit, 1/2/4 writers)
--roundsintegerTimed rounds per case (override)
-o/--outputtextDirectory for the result folder (default: .benchmarks)
--no-saveflagPrint the summary but don't write a result folder

litmus catalog (group) {#cli-catalog} #

Catalog commands.

litmus catalog datasheet {#cli-catalog-datasheet} #

Generate a formatted datasheet from a catalog YAML file.

Argument / optionTypeDescription
YAML_PATHpath
-f/--format{html, pdf}Output format (default: html) (default: html)
-o/--outputpathOutput file path

litmus daemon (group) {#cli-daemon} #

Manage Litmus background daemons (events / runs / channels).

litmus daemon restart {#cli-daemon-restart} #

Restart selected daemons (SIGTERM the running process; respawn on next access).

Argument / optionTypeDescription
TARGETS...text
--allflagRestart every daemon under the project

litmus daemon status {#cli-daemon-status} #

Show running daemons, their PIDs, refs, and locations.

(no options or arguments.)

litmus daemon stop {#cli-daemon-stop} #

Stop selected daemons without respawning.

Argument / optionTypeDescription
TARGETS...text
--allflagStop every daemon under the project

litmus data (group) {#cli-data} #

Data retention and management.

litmus data import {#cli-data-import} #

Merge another data_dir into this one; the store daemons rebuild from the files.

Argument / optionTypeDescription
SOURCEdirectory
--data-dirtextDestination results dir (default: configured).

litmus data promote {#cli-data-promote} #

Move a starter project's local runs + their referenced data to the global store.

Argument / optionTypeDescription
--include-starterflagAlso promote runs that match starter sentinels (example_part / starter_station / STARTER001 / etc.). Default skips these as throwaway learning runs.
--dry-runflagShow what would be promoted; write nothing.
--with-eventsflagAlso carry each run's session event timeline (audit-grade archive).

litmus data prune {#cli-data-prune} #

Delete date-partitioned data older than the specified period.

Argument / optionTypeDescription
--older-thantextRetention period (e.g. 30d, 90d)
--typetextData types to prune (e.g. channels, files, events)
--data-dirtextResults directory
--dry-runflagShow what would be deleted
--exttextOnly prune files with these extensions (tiered retention, e.g. --ext tdms). Files only.

litmus data reindex {#cli-data-reindex} #

Kill index daemons and rebuild on next access.

Argument / optionTypeDescription
--data-dirtextResults directory

litmus discover {#cli-discover} #

Scan for available instruments.

Argument / optionTypeDescription
--visaflagVISA instruments only
--niflagNI devices only
--serialflagSerial ports only
--lxiflagLXI network instruments only
--identify/--no-identifyflagQuery *IDN? for each instrument
--jsonflagOutput as JSON

litmus export {#cli-export} #

Export a test run or session to a different format via event replay.

Argument / optionTypeDescription
IDtext
-f/--formattextTarget format (csv, json, stdf, hdf5, tdms, mdf4)
-o/--output-dirtextOutput directory
--data-dirtextData directory

litmus grafana (group) {#cli-grafana} #

Grafana dashboard provisioning and data server.

litmus grafana export {#cli-grafana-export} #

Export dashboards and provisioning templates for manual setup.

Argument / optionTypeDescription
--output-dir/-opathOutput directory (default: grafana-export)

litmus grafana serve {#cli-grafana-serve} #

Start the pgwire server for Grafana.

Argument / optionTypeDescription
--hosttextBind address (default: 0.0.0.0)
--portintegerPostgreSQL wire protocol port (default: 5433)
--data-dirpath
--refresh-secondsintegerSeconds between IPC table refreshes (events, channels) (default: 30)

litmus grafana setup {#cli-grafana-setup} #

Install provisioning config and dashboards into Grafana.

Argument / optionTypeDescription
--grafana-homedirectoryGrafana installation directory (default: auto-detect)
--grafana-urltextGrafana URL for API setup (e.g. http://localhost:3000)
--grafana-tokentextGrafana API token or service account token
--grafana-usertextGrafana username for basic auth
--grafana-passwordtextGrafana password for basic auth
--hosttextpgwire host for datasource config (default: 127.0.0.1)
--portintegerpgwire port for datasource config (default: 5433)
--foldertextGrafana folder for dashboards (default: Litmus)

litmus init {#cli-init} #

Initialize a new Litmus project.

Argument / optionTypeDescription
NAMEtext
--no-gitflagSkip git initialization
--discoverflagAuto-discover instruments and create station file
--starter/--no-starterflagGenerate starter example files (prompts if not specified)
--tier{bringup, bench, factory}Scaffold tier. 'bringup' = Tier 0/1 (MagicMock fixtures, one test, one sidecar, no station/part YAML). 'bench' = Tier 2 starter (equivalent to --starter). 'factory' = Tier 3/4 (bench + profiles).
--ai{claude-code, claude-desktop, copilot}Set up AI tool integration (MCP server + project instructions)
--nametextProject name (overrides auto-detect)

litmus instrument (group) {#cli-instrument} #

Instrument management commands.

litmus instrument cal {#cli-instrument-cal} #

Update calibration information for an instrument.

Argument / optionTypeDescription
INSTRUMENT_IDtext
--duetextCalibration due date (YYYY-MM-DD)
--lasttextLast calibration date (YYYY-MM-DD)
--certtextCertificate number
--labtextCalibration lab name

litmus instrument list {#cli-instrument-list} #

List all instrument configuration files.

Argument / optionTypeDescription
--jsonflagOutput as JSON

litmus instrument show {#cli-instrument-show} #

Show details for a specific instrument.

Argument / optionTypeDescription
INSTRUMENT_IDtext
--jsonflagOutput as JSON

litmus mcp (group) {#cli-mcp} #

MCP server commands for AI-assisted workflows.

litmus mcp serve {#cli-mcp-serve} #

Start the MCP server for AI agents.

Argument / optionTypeDescription
--transporttextTransport type (stdio, sse) (default: stdio)

litmus metrics (group) {#cli-metrics} #

Manufacturing-test analytics (yield, pareto, ppk, trend, retest, time-loss).

litmus metrics pareto {#cli-metrics-pareto} #

Top failures (Pareto). Group by part / step / measurement.

Argument / optionTypeDescription
--jsonflagOutput as JSON
--stationtextStation ID
--parttextPart ID
--untiltextEnd date (ISO format)
--sincetextStart date (ISO format)
--phasetextTest phase (or 'all')
--data-dirtextResults directory
--topintegerNumber of top failures (default: 10)
--group-by{part, step, measurement}Lens for the pareto: part groups runs by uut_part_number (most-failing SKUs); step groups steps by step_path (most-failing tests); measurement groups limit-bearing measurements by name (the historical default). (default: part)

litmus metrics ppk {#cli-metrics-ppk} #

Process performance (Ppk/Pp) per measurement.

Argument / optionTypeDescription
--jsonflagOutput as JSON
--stationtextStation ID
--parttextPart ID
--untiltextEnd date (ISO format)
--sincetextStart date (ISO format)
--phasetextTest phase (or 'all')
--data-dirtextResults directory
--min-samplesintegerMinimum sample count (default: 10)

litmus metrics retest {#cli-metrics-retest} #

Retest rates: how often UUTs are retried.

Argument / optionTypeDescription
--jsonflagOutput as JSON
--stationtextStation ID
--parttextPart ID
--untiltextEnd date (ISO format)
--sincetextStart date (ISO format)
--phasetextTest phase (or 'all')
--data-dirtextResults directory
--period{day, week, month}(default: day)

litmus metrics summary {#cli-metrics-summary} #

Yield summary: FPY, final yield, run counts, RTY, DPMO, DPPM, duration stats.

Argument / optionTypeDescription
--jsonflagOutput as JSON
--stationtextStation ID
--parttextPart ID
--untiltextEnd date (ISO format)
--sincetextStart date (ISO format)
--phasetextTest phase (or 'all')
--data-dirtextResults directory
--period{day, week, month}(default: day)

litmus metrics time-loss {#cli-metrics-time-loss} #

Time lost to failures and errors.

Argument / optionTypeDescription
--jsonflagOutput as JSON
--stationtextStation ID
--parttextPart ID
--untiltextEnd date (ISO format)
--sincetextStart date (ISO format)
--phasetextTest phase (or 'all')
--data-dirtextResults directory
--period{day, week, month}(default: day)

litmus metrics trend {#cli-metrics-trend} #

Yield trend over time.

Argument / optionTypeDescription
--jsonflagOutput as JSON
--stationtextStation ID
--parttextPart ID
--untiltextEnd date (ISO format)
--sincetextStart date (ISO format)
--phasetextTest phase (or 'all')
--data-dirtextResults directory
--period{day, week, month}(default: day)

litmus new-test {#cli-new-test} #

Scaffold a new test file.

Argument / optionTypeDescription
NAMEtext

litmus refs (group) {#cli-refs} #

Stream curated reference docs to stdout.

litmus refs list {#cli-refs-list} #

List available reference topics.

(no options or arguments.)

litmus refs show {#cli-refs-show} #

Print the named reference doc to stdout.

Argument / optionTypeDescription
TOPICtext

litmus runs {#cli-runs} #

List recent test runs.

Argument / optionTypeDescription
--data-dirtextResults directory
--limitintegerNumber of runs to show (default: 20)
--jsonflagOutput as JSON

litmus sbom {#cli-sbom} #

Export CycloneDX SBOM for a test run's software environment.

Argument / optionTypeDescription
RUN_IDtext
--data-dirtextResults directory
-o/--outputtextOutput file (default: stdout)

litmus schema (group) {#cli-schema} #

JSON Schema generation for YAML validation.

litmus schema export {#cli-schema-export} #

Export JSON Schema files for all Litmus YAML types.

Argument / optionTypeDescription
--output-dir/-otextDirectory for .schema.json files (default: schemas)

litmus schema refresh {#cli-schema-refresh} #

Refresh .vscode/schemas/ and .vscode/settings.json after a Litmus upgrade.

Argument / optionTypeDescription
--project-dirtextProject root (defaults to current directory). (default: .)

litmus serve {#cli-serve} #

Start the operator UI server.

Argument / optionTypeDescription
--hosttextHost to bind to (default: 127.0.0.1)
--portintegerPort to bind to (default: 8000)
--reloadflagEnable auto-reload for development

litmus setup (group) {#cli-setup} #

Configure AI tool integrations.

litmus setup claude-code {#cli-setup-claude-code} #

Configure Litmus MCP server for Claude Code.

Argument / optionTypeDescription
--print-onlyflagPrint config instead of installing

litmus setup claude-desktop {#cli-setup-claude-desktop} #

Configure Litmus for Claude Desktop.

Argument / optionTypeDescription
--legacyflagUse legacy JSON config instead of .mcpb bundle
--print-onlyflagPrint config instead of installing

litmus setup cline {#cli-setup-cline} #

Configure Litmus MCP server for Cline (VS Code extension).

Argument / optionTypeDescription
--print-onlyflagPrint config instead of installing

litmus setup copilot {#cli-setup-copilot} #

Configure Litmus for GitHub Copilot (VS Code + CLI).

Argument / optionTypeDescription
--print-onlyflagPrint config instead of installing

litmus setup cursor {#cli-setup-cursor} #

Configure Litmus MCP server for Cursor.

Argument / optionTypeDescription
--print-onlyflagPrint config instead of installing

litmus setup show {#cli-setup-show} #

Show current MCP server configuration.

(no options or arguments.)

litmus show {#cli-show} #

Show details for a specific test run.

Argument / optionTypeDescription
RUN_IDtext
--data-dirtextResults directory
-f/--format{html, pdf, json, csv}Generate report in format
-o/--outputtextOutput file or directory
-t/--templatetextReport template name (default: default)
--envflagShow environment snapshot

litmus station (group) {#cli-station} #

Station management commands.

litmus station init {#cli-station-init} #

Initialize a new station configuration.

Argument / optionTypeDescription
--station-idtextUnique station identifier
--nametextHuman-readable station name
--locationtextPhysical location

litmus station update {#cli-station-update} #

Re-discover and update instrument identity in configuration.

Argument / optionTypeDescription
STATION_IDtext

litmus station validate {#cli-station-validate} #

Validate station instruments against configuration.

Argument / optionTypeDescription
STATION_IDtext
--strictflagFail on any mismatch

litmus validate {#cli-validate} #

Validate YAML configuration files.

Argument / optionTypeDescription
PATHS...path
--type/-t{catalog, part, station, sequence, fixture, instrument_asset, project}Explicit file type (skips auto-detection).
--jsonflagOutput as JSON

Test phase #

test_phase tags every run with the maturity tier it was produced for (development, validation, characterization, production). It lands on every parquet row so dashboards and queries can filter by phase.

Setting the phase #

Resolution order (first match wins):

  1. pytest --test-phase=<phase> — explicit per-run.
  2. LITMUS_TEST_PHASE env var.
  3. Defaultdevelopment when neither is set.

Git-status and mock enforcement #

Non-development phases require a clean git repository and real instruments. Uncommitted changes (or no git at all), or running with --mock-instruments, force the stamp down to development regardless of what was requested — a production-tagged row is then always reproducible from a commit hash and came from real hardware. (Profile selection still honors the requested phase; only the recorded stamp is demoted.)

Git statusRequestedStamp
Cleanvalidationvalidation
Cleanproductionproduction
Clean(none)development
Dirtyvalidationdevelopment
Dirtyproductiondevelopment
Dirty(none)development
No git(any)development
Any(any, --mock-instruments)development

Query by phase #

import duckdb
 
duckdb.sql("""
    SELECT * FROM read_parquet('data/runs/**/*.parquet')
    WHERE test_phase = 'production'
""")
 
# Exclude dev work
duckdb.sql("""
    SELECT * FROM read_parquet('data/runs/**/*.parquet')
    WHERE test_phase != 'development'
""")

See Profiles for the profile YAML shape.

Environment variables #

VariableDescription
LITMUS_HOMEDefault data directory. Resolution: --data-dir arg → project litmus.yaml data_dir:LITMUS_HOMEplatformdirs.user_data_dir("litmus").
LITMUS_FILES_BACKENDSelects the FileStore backend for captured artifacts; takes precedence over litmus.yaml files.backend (default: local filesystem).
LITMUS_TEST_PHASEDefault test_phase for runs (see Test phase above).
LITMUS_TEST_PROFILEDefault profile name; equivalent to --test-profile.
LITMUS_MOCK_INSTRUMENTSSet to 1 to enable mock mode without passing --mock-instruments.
LITMUS_AUTO_CONFIRMTruthy → auto-resolve operator prompts and dialogs in non-tty contexts (CI, subprocess runs). Set to "confirm" to auto-confirm, "cancel" to auto-cancel; any other truthy value defaults to confirm.
LITMUS_SERVER_URLServer URL the dialog bridge uses to POST operator prompts from subprocess test runs back to the UI host (default: http://localhost:8000).
LITMUS_UUT_SERIALDefault UUT serial (shared across slots). For per-slot serials, use LITMUS_UUT_SERIAL_<SLOT_ID> (e.g. LITMUS_UUT_SERIAL_SLOT_1).
LITMUS_UUT_PART_NUMBERDefault UUT part number (uut_part_number on every run).
LITMUS_UUT_REVISIONDefault UUT hardware revision.
LITMUS_UUT_LOT_NUMBERDefault UUT lot / batch number.
LITMUS_FIXTURE_SLOTSet by the multi-UUT orchestrator for per-slot child processes; not operator-configurable.
LITMUS_DAEMON_IDLE_TIMEOUTSeconds a background daemon (events, runs, channels) waits idle before self-shutting-down (default: 300).
LITMUS_DAEMON_SPAWN_TIMEOUTSeconds to wait for a daemon to report ready after spawning (default: 30).
LITMUS_CHANNELS_SYNC_PUSHSet to 1 to force channel-sample writes to push synchronously instead of the default async push (determinism / debugging).
LITMUS_SKIP_DAEMON_NOTIFYSuppresses the daemon-notify hop — useful in tooling scripts that read stored runs without serving them.

Exit codes #

CodeMeaning
0Success
1General error (invalid options, missing files, validation failures)
2Command not found / usage error (Click standard)

See also #