Skip to content

Command line guide

Use the Lutra CLI when you want to:

  • check projects for errors,
  • run programs locally and remotely,
  • explore data interactively,
  • generate bindings for Python or Rust.

For exact command and option details, see the CLI reference.

Install the CLI

Using Nix

If you use Nix, install the CLI with:

$ nix profile install 'git+https://codeberg.org/lutra/lutra-data.git'

Using Cargo

Prerequisites:

Then install the CLI:

$ cargo install lutra-cli

Note

The CLI depends on DuckDB. On Debian or Ubuntu, you can install it with apt install libduckdb-dev. On macOS, you can use brew install duckdb.

Optional: you can also use --features bundled to compile DuckDB from source. This requires a C++ compiler.

Run your first program

Create a file named example.lt:

func main() -> "Hello, world!"

Run it with the local interpreter:

$ lutra run --project example.lt --interpreter
const output = "Hello, world!"

This is the fastest way to try out small language examples from the learning guides.

Check a project

Use check to validate a project without running it.

$ lutra check --project example.lt
All good.

This is useful when you want type checking and diagnostics while editing code.

Run an expression directly

You can also run a one-off expression without creating a project function.

$ lutra run \
    --interpreter \
    --program 'fold([1, 2, 3], 0: int32, func (s, v) -> s + v)'
6

This is handy for quick experiments.

Explore a project interactively

Use interactive when you want a live project environment with recompilation.

$ lutra interactive --project example.lt --interpreter

You can also use other runners:

$ lutra interactive --project project.lt --postgres 'postgres://user:pass@localhost:5432/db'
$ lutra interactive --project project.lt --duckdb ':memory:'

interactive is a good fit for exploration, rapid iteration, and trying transformations against a real backend.

Generate bindings

Use codegen when you want to call Lutra programs from another language.

Generate Rust bindings:

$ lutra codegen --project ./project.lt ./lutra.rs
Used files:
- project.lt
Output written to lutra.rs
Done.

Generate Python bindings:

$ lutra codegen --project ./project.lt ./generated.py

See also