On this page
Projects
A Halyard project is a directory containing a halyard.toml manifest file. The manifest declares your project's entry point and permissions, so you don't need to pass environment variables or flags on every invocation.
Creating a Project
Use halyard init to scaffold a new project:
halyard init my-project
This creates a my-project/ directory with a minimal project structure:
my-project/
halyard.toml
src/
main.hly
modules/ -- user-defined file modules go here
For a data pipeline scaffold with IO and DataFrame permissions pre-configured:
halyard init my-pipeline --template pipeline
Project Manifest
The halyard.toml file describes your project:
[project]
name = "my-project"
version = "0.1.0"
main = "src/main.hly"
| Field | Required | Default | Description |
|---|---|---|---|
name | Yes | — | Project name |
version | Yes | — | Project version |
main | No | src/main.hly | Entry point for halyard run |
The [project] table is required: it is what makes a directory a project. A halyard.toml that Halyard finds but cannot load stops the command with the file's path and the problem, rather than running as if it were not there, so a typo never silently drops the restrictions the file declares:
halyard run
# Error: /home/me/my-project/halyard.toml is not a valid halyard.toml: TOML parse error at line 7, column 12
# |
# 7 | max_rows = "one"
# | ^^^^^
# invalid type: string "one", expected usize
That holds for a file that is not TOML, a missing [project] table, a [project] without name or version, and a field of the wrong type, and for every command that reads the project (halyard run, check, trace, -f, info, flow, graph, list). The nearest halyard.toml above a file decides, so a broken one in a subfolder stops the files below it even inside a valid project. The language server reports the same problem as an error at the top of each file the halyard.toml governs, and does not type-check those files until the halyard.toml loads (you still get syntax errors). The TUI does not open such a project: halyard tui --module-root stops, and when an editor sends the TUI a project whose halyard.toml cannot be loaded, the TUI refuses every cell with the error until it gets a project whose halyard.toml loads.
Permissions
Permissions sections control what capabilities your Halyard code has access to. All sections are optional — missing sections keep the default behavior.
IO Permissions
[permissions.io]
enabled = true
read_only = false
sandbox = "./data"
| Field | Default | Description |
|---|---|---|
enabled | false | Enable file IO operations |
read_only | false | Restrict to read-only file access |
sandbox | — | Restrict IO to this directory (relative to project root) |
With IO enabled, you can read JSONL files and parse them in a pipeline:
import IO
import Jsonl
import Result
IO.readFile "data/events.jsonl"
|> Result.andThen Jsonl.parse
HTTP Permissions
[permissions.http]
enabled = true
allowed_hosts = ["api.example.com"]
| Field | Default | Description |
|---|---|---|
enabled | false | Enable HTTP requests |
allowed_hosts | — | Restrict requests to these hosts |
DataFrame Permissions
[permissions.dataframe]
enabled = true
sandbox = "./data"
max_rows = 1_000_000
| Field | Default | Description |
|---|---|---|
enabled | true | Enable DataFrame operations |
sandbox | — | Restrict DataFrame file access to this directory |
max_rows | — | Maximum number of rows allowed |
enabled and sandbox also bind the compiler: a constant path it would read to check a schema (DataFrame.readCsv "data/sales.csv") and these settings forbid is a compile error. See DataFrame Type Safety.
Which setting wins
Every permission and compliance setting is decided on its own, in this order (the same order Cargo uses):
command-line flag > HALYARD_* environment variable > halyard.toml > built-in default
The first source that sets a value wins. Halyard has no permission flags today, so in practice an environment variable overrides halyard.toml, and halyard.toml overrides the default. The one flag among these settings is halyard run --audit-log, which overrides [compliance] output and HALYARD_COMPLIANCE_OUTPUT. halyard.toml states the project's defaults; whoever runs the code can change any of them, tighter or wider, from the environment:
HALYARD_DATAFRAME_MAX_ROWS=1 halyard run # 1 row, whatever halyard.toml says
HALYARD_IO_DISABLED=0 halyard run # IO enabled, even if halyard.toml disables it
A value the variable does not accept is an error, as in Cargo: halyard names the variable, its value and the values it accepts, and runs nothing. That includes the empty string, so HALYARD_DATAFRAME_SANDBOX= or an unset shell variable expanded into HALYARD_IO_SANDBOX=$DIR stops the command instead of silently removing the sandbox:
HALYARD_DATAFRAME_DISABLED=yes halyard run
# Error: invalid value "yes" in environment variable `HALYARD_DATAFRAME_DISABLED`:
# expected `1`, `0`, `true` or `false`; correct it or unset `HALYARD_DATAFRAME_DISABLED`
halyard run, halyard -f, check, trace, repl, info, flow, graph, list and tui check every variable before they start; the language server shows the same error as a diagnostic and type-checks no file while it is set, the REPL refuses to start, and the TUI and notebooks refuse each cell with it.
The halyard.toml that applies is the one of the project the file belongs to: the nearest halyard.toml above the file, wherever you run it from (for halyard run without a file, the file is the project's main). Code that belongs to no project, such as a file in /tmp, code piped in with halyard run /dev/stdin < script.hly or halyard -f <(...), or inline source given to halyard trace, reads no halyard.toml at all, even when you run it from inside a project: only the environment and the defaults apply.
A yes/no variable accepts exactly 1, 0, true or false (the words in any case), with no spaces around it.
halyard.toml setting | Environment variable: accepted values | Default |
|---|---|---|
[permissions.io] enabled | HALYARD_IO_DISABLED: yes/no; 0 or false enables IO | disabled |
[permissions.io] read_only | HALYARD_IO_READ_ONLY: yes/no; 1 or true is read-only | read and write |
[permissions.io] sandbox | HALYARD_IO_SANDBOX: a directory (not empty) | none |
[permissions.http] enabled | HALYARD_HTTP_DISABLED: yes/no; 0 or false enables HTTP | disabled |
[permissions.http] allowed_hosts | HALYARD_HTTP_ALLOWED_HOSTS: comma-separated host names, none of them blank. In halyard.toml, allowed_hosts = [] allows no host; leave the setting out to allow every host | any host |
[permissions.dataframe] enabled | HALYARD_DATAFRAME_DISABLED: yes/no; 1 or true disables DataFrame | enabled |
[permissions.dataframe] sandbox | HALYARD_DATAFRAME_SANDBOX: a directory (not empty) | none |
[permissions.dataframe] max_rows | HALYARD_DATAFRAME_MAX_ROWS: a whole number such as 10000 (0 allows no rows) | no limit |
[compliance] enabled | HALYARD_COMPLIANCE_ENABLED: yes/no | off |
[compliance] user | HALYARD_COMPLIANCE_USER: a name (not empty) | none |
[compliance] fields | HALYARD_COMPLIANCE_FIELDS: comma-separated, from source_hash, user, input_files, output_files, dataframes. Empty means every field: the one variable whose empty value is accepted | all |
[compliance] format | HALYARD_COMPLIANCE_FORMAT: exactly json, the only manifest format | json |
[compliance] output | HALYARD_COMPLIANCE_OUTPUT: a path (not empty), the file each run's manifest is appended to. halyard run --audit-log overrides it | none: the manifest is not written |
[compliance] hmac_key | HALYARD_COMPLIANCE_HMAC_KEY: a hex-encoded key such as 00ff; spaces around it are ignored | unsigned |
Spaces around each item of a host or field list are ignored (a.com, b.com). In halyard.toml, an hmac_key that is not hex, a fields entry that names no manifest field, or an allowed_hosts entry that is blank or holds a comma makes the halyard.toml invalid, like any other invalid halyard.toml: halyard commands stop on it, the language server reports it and does not type-check the files it governs, and the TUI does not open that project and refuses every cell sent from it.
The language server applies the same order, so the editor checks a file under the settings halyard run would use.
REPL
The [repl] section configures the interactive REPL (TUI and halyard repl).
[repl]
undo_depth = 10
| Field | Default | Description |
|---|---|---|
undo_depth | 0 (disabled) | Number of undo steps to retain. Each step holds a full snapshot of the VM, including any loaded DataFrames. Set to 0 or omit to disable undo and avoid memory retention. |
Undo is disabled by default because each snapshot retains Arc references to every loaded DataFrame — a 5 GB DataFrame followed by 20 evals would keep 5 GB in the undo stack indefinitely. Enable it only when your data fits comfortably in memory.
Once enabled, use :undo or :u in the TUI or halyard repl to step back through evaluations.
Running a Project
From anywhere inside a project directory:
halyard run
This finds the nearest halyard.toml by walking up from the current directory, applies permissions, and runs the entry point.
You can also run a specific file while still using the project's permissions:
halyard run src/other.hly
Running without a manifest and without a file argument produces an error:
halyard run
# Error: No file specified and no halyard.toml found
Project Templates
Minimal (default)
The minimal template creates a simple project with just an entry point:
"Hello from my-project!"
Pipeline
The pipeline template scaffolds a data pipeline with extract/transform/load steps using tasks:
-- my-pipeline data pipeline
-- Run with: halyard run
let { data } = run "steps/extract.hly"
let { transformed } = run "steps/transform.hly" { data }
run "steps/load.hly" { transformed }
Bare paths like "steps/extract.hly" resolve from the project root (the halyard.toml directory). Inside the step files themselves, use ./ for paths relative to that file — see Path Resolution in the Tasks guide.
It also pre-configures IO and DataFrame permissions with a ./data sandbox.
Next Steps
- Modules — Organize code within files
- Error Handling — Handle errors in your pipelines