#Deploy tutorial
How to run a program on your own computer with the elucid8 command. There are three ways to get it: pip install elucid8, with no sign-in, installs the Python package, which includes the command (see eLucid8 from Python); signed in on the site's Download page, you can download it as a single file for macOS, Linux or Windows, or, on macOS and Linux, copy a personal one-line install command. In the playground, signed in, Download saves your program as a zip with its plan, its data and a configuration, and elucid8 run runs it. With the command installed by pip, type elucid8 wherever this tutorial writes ./elucid8.
One program, many runtimes: every way of running a program runs the same plan and gives exactly the results the playground gives. For the language itself, see the tutorial; for the playground, the Playground Tutorial; for how the parts relate, How eLucid8 fits together.
#Your first program on your computer
Two files and one command. Get the elucid8 command first (Install it, in step 2). Then, in a new folder, save this program as count.el8:
x = 1 fby.t x + 1
output("x") = restrict x to (t : 10) end
x is 1 at the first step, then one more at each step, with no end. output("x") writes its first ten: t from 0 to 9. Save this as deploy.json beside it. It sends the output to standard output ("-"), each value plainly on a line of its own (Constant):
{ "format": "elucid8-deploy/2",
"outputs": { "x": { "to": "-", "format": "txt" } } }
Put the elucid8 command in the folder too, and run it:
./elucid8 run count.el8 --config deploy.json
It prints the numbers 1 to 10, one a line, and nothing else:
1
2
3
4
5
6
7
8
9
10
The command compiles the program, computes x at the ten points the output asks for, and writes them. The rest of this tutorial does the same with a program made in the playground: its data, the files the Download gives, and more of what the command does.
#1. Download your program (available now)
This tutorial uses one small program throughout, in the language's notation v0.2:
-- A running sum, and a ratio that fails where x is 0.
x = input("x", t : inf)
running = x fby.t (running + next.t x)
ratio = running / x
x has no end along t (inf: as many rows as its data has), and has data for t from 0 to 5; past them, x and everything computed from it is eod (the data end there). A bound such as t : 1000 would say there are exactly 1,000 points: then t = 6 to 999 would be missing data (an error of kind missing), not eod.
- Open the playground and paste the program (or write your own, or open one you saved). Give the input
xthe table below and queryrunningat t = 4: the answer is 13.
t,value
0,3
1,1
2,4
3,0
4,5
5,9
- Sign in, press Save as my program and give it the name
Running sum. - Press More ▾, then Download (or Download next to the program in My programs). Your browser saves
running-sum.zip: the title, as a file name.
#What's in the zip
A folder, running-sum, with everything the elucid8 command needs to run the program:
| file | what it is |
|---|---|
plan.json | your program, compiled: the contract every eLucid8 engine runs (below) |
program.el8 | your program's source, as you saved it: edit it, then compile it again, with the site's compiler at https://elucid8-lang.org/api/compile (how; AGENTS.md gives the command too) |
data/x.csv | the data for the input x: the table you gave it in the playground. Every input's data is in the data folder |
deploy.json | the configuration: where each input's data comes from, where each output goes (a program with outputs writes them to an out folder, which elucid8 run makes), and what to compute |
README.txt | what the files are, and the one command to run |
AGENTS.md | instructions for an AI coding agent working in the folder (Using eLucid8 with AI coding agents) |
CLAUDE.md | the same, for Claude Code: it imports AGENTS.md |
connectors/connector_template.py | a template for a connector: a short program that reads your rows from a database, an API or a stream, or writes your results to one (Connecting eLucid8 to your data) |
A program with an input answered on demand has its provider in deploy.json (the last part of step 2 shows one).
#What a plan is
A plan is your program compiled to a versioned JSON file. It is the contract every eLucid8 engine runs: the reference evaluator behind the playground, the native elucid8 command and the WebAssembly module all read the same file.
A plan holds the program only. The table you gave x in the playground is not in it: it comes beside the plan, in data/x.csv, and deploy.json says that x comes from that file. Wherever you run the plan, you can give each input other data.
#What's in it
The plan starts with what it is and what it was made with:
{
"planVersion": 26,
"engineVersion": "elucid8-ts/0.1.0",
"mathLibrary": "fdlibm-5.3+exp1+msun-tanh",
"sourceHash": "8a90ccdf249f8fde",
"dimensions": [
{
"name": "t",
"type": "int",
"origin": 0,
"kind": "number"
}
],
planVersion: the format, 19 for every program, whichelucid8reads from 0.20.0 (0.19.0 reads 18). An engine refuses a version it does not read, rather than guess. The release notes say which release reads which.engineVersion: the compiler that wrote the plan.mathLibrary: the one maths library every engine uses, soexp,logand the others are designed to give the same bits on every machine (checked on macOS, Linux, Windows and Chrome).sourceHash: a fingerprint of the program text. Yours differs if your text differs by even one character.dimensions:t, its origin, 0, wherefby.tstarts, and its kind: its coordinates are whole numbers (fby.tmoves along it).
Then each input and value. Here is ratio:
{
"name": "ratio",
"kind": "value",
"dims": [
"t"
],
"version": "c82be9af05da2a98",
"equation": {
"op": "binary",
"fn": "/",
"left": {
"op": "ref",
"name": "running"
},
"right": {
"op": "ref",
"name": "x"
}
},
version: a fingerprint of this declaration. Change the equation and it gets a new version, so results computed from the old one are never reused.equation:running / xas a tree, which every engine evaluates the same way.- After the equation,
ratiohas akernel: a faster form for computing many points at once, which must give exactly what the equation gives.runninghas areasoninstead, saying why it has none. - The input
xis listed only by its channel and dimensions (thas no bound: it has no end). The plan also lists every channel a deployment must give an entry ininputs.
#The data: data/x.csv
t,value
0,3
1,1
2,4
3,0
4,5
5,9
A header naming the input's dimensions and value, then one row per point: the table you typed, in the notation the command reads, which is the playground's own. A cell eod is eod, and error: sensor fault is an error. A point the file does not list is eod past the file's last row along t, and missing data among its rows. A table with a ts column gives each row a timestamp in milliseconds, and deploy.json then binds it with "time": "ts" (Values and timestamps).
Where an input has no table, the file is made for you:
- A formula, or an example's built-in data (the Game of Life's random board, the Alps temperatures): its values at every point of the input's bound, such as
seed = input("seed", x : 24, y : 24). - Data with a licence, such as the Alps example's Open-Meteo temperatures (CC BY 4.0): its attribution is kept, in
README.txtand as a comment line (starting with#) at the top of the CSV file. - An outcome a CSV cell cannot carry exactly (for example a non-finite error) puts that input in a JSON-lines file instead,
data/x.jsonl.
#The configuration: deploy.json
{
"format": "elucid8-deploy/2",
"inputs": {
"x": {
"from": "data/x.csv"
}
},
"queries": [
"running[t = 4]"
]
}
It says that the input x comes from data/x.csv, and asks for the query you saved, running at t = 4. Paths are relative to the configuration file, and it never holds credentials. The command reference describes every field.
#Why the plan matters
- The same results everywhere. The plan fixes every equation, the order in which sums add up, and the maths library. Every engine is tested against the reference, outcome by outcome, so a plan cannot mean one thing in the playground and another in production.
- No data and no secrets. You choose where each input comes from when you deploy, and a plan never holds a key or a password.
- A record. Keep the plan with your results: it says exactly which program produced them.
#2. Run it with the elucid8 command
elucid8 is a small native program, a single file, that runs a plan with your data files and the programs that answer its inputs. It needs no browser and no Node.
Platforms: the command is offered for macOS (Apple silicon and Intel, macOS 11 or later), Linux (x86-64 and ARM64) and Windows (x86-64). The Download page puts your platform first. The steps below are for macOS; On Linux and Windows says how they differ.
#Install it
Downloading the command needs a sign-in on the site's Download page. There are two ways.
The quick way, on macOS and Linux. Signed in on the Download page, press Get my install command under Install from a terminal, and copy the line it shows into Terminal. It looks like this, with your own token at the end:
curl -fsSL https://elucid8-lang.org/install.sh | sh -s -- <your token>
It downloads the file for your computer, checks its SHA-256, makes it executable and puts it in ~/.local/bin (or in the folder ELUCID8_INSTALL_DIR names), then prints its version. The command is yours alone: it works for an hour, up to 5 times, and you can get a new one any time. It does not mark the file as downloaded, so macOS runs it without asking. Running it again installs the latest release. Then unzip your program and go to its folder, as below, and type elucid8 wherever this tutorial writes ./elucid8 (if the script says ~/.local/bin is not on your PATH, it also says what to add).
Or download it. On the site's Download page, sign in, and press Download elucid8. Your browser saves a file named elucid8, usually in your Downloads folder. The page also shows the file's size and its SHA-256, a fingerprint of its bytes.
Put the command in your program's folder. In Terminal (Applications → Utilities → Terminal), unzip the program you downloaded in step 1, move the command into its folder, and go there:
cd ~/Downloads
unzip running-sum.zip
mv elucid8 running-sum/
cd running-sum
If your browser has already unzipped the file (Safari does), skip the unzip line. If it saved the files elsewhere, or named the command elucid8 (1), move and rename it yourself so that the folder running-sum holds elucid8 beside plan.json.
Check the file. Make sure it is the one the Download page describes:
shasum -a 256 elucid8
It prints a long hexadecimal number and the file's name. The number must be the SHA-256 shown on the Download page. If it is not, delete the file and download it again.
Make it executable. A browser does not keep a program's permission to run when it downloads it:
chmod +x elucid8
Let macOS open it. The program is signed with Apple's Developer ID and notarised by Apple. Your browser marks every file it downloads as coming from the internet, so the first time you run it, macOS asks whether you are sure you want to open it, saying Apple checked it for malicious software and found none. Choose Open. macOS asks only once for this file; a file you download again asks again. (The install command above does not add the mark, so macOS does not ask.)
Check that it runs:
./elucid8 --version
elucid8 0.26.0
plan versions: 26
maths library: fdlibm-5.3+exp1+msun-tanh
configuration: elucid8-deploy/2
It names the plan versions it runs and the maths library it uses, as your plan.json does. The ./ tells the shell to run the elucid8 in this folder. To type elucid8 alone from any folder, move it to a folder on your PATH, such as /usr/local/bin (that needs sudo).
Not checked by our tests: the macOS messages and the System Settings steps. Our tests run every command on this page and check what it prints, but they cannot open System Settings or see what macOS shows, and the wording differs between macOS versions. If what you see differs, tell us.
#On Linux and Windows
The steps differ only as below. Our tests run the macOS commands above on a Mac; the commands in this section are not run by them, and the Windows wording is unverified until someone has run it.
Linux (x86-64 or ARM64). The personal install command above works on every distribution (with curl, or GNU wget): it installs the desktop build, which also opens elucid8 window, where it finds glibc 2.35 or later and WebKitGTK 4.1 (sudo apt install libwebkit2gtk-4.1-0 on Debian and Ubuntu), and otherwise the static build, which runs on any distribution. To download it yourself instead: the file is elucid8, from Linux desktop or Linux. Check it with sha256sum elucid8 instead of shasum -a 256 elucid8, and make it executable with chmod +x elucid8. There is no quarantine step: run ./elucid8 --version, then every command of this tutorial as written.
Windows (x86-64). The file is elucid8.exe.
A folder inside a folder. Windows' Extract All puts the zip's folder inside a folder of the same name, so the program's files are one level further down than you might expect: running-sum\running-sum\plan.json. Work in the inner folder, the one that holds plan.json, and put elucid8.exe there. In PowerShell, from the folder you extracted into, with elucid8.exe saved in the outer folder: go into the inner folder, copy the command in, check it and run it:
cd running-sum\running-sum
Copy-Item ..\elucid8.exe .
Get-FileHash elucid8.exe -Algorithm SHA256
.\elucid8.exe --version
.\elucid8.exe run plan.json --config deploy.json
Get-FileHash prints the SHA-256 in capital letters; it is the same number as on the Download page. In Command Prompt, certutil -hashfile elucid8.exe SHA256 prints it, and elucid8.exe run plan.json --config deploy.json runs it. The first time, Windows may stop it with "Windows protected your PC" (Microsoft Defender SmartScreen, which can warn about a new program even when it is signed; this one is signed with Azure Artifact Signing): choose More info, then choose Run anyway.
In the commands of this tutorial, write .\elucid8.exe for ./elucid8. PowerShell takes queries in single quotes as written here (--query 'running[t = 4..5]'); in Command Prompt, use double quotes. To keep results in a file, use --out results.jsonl rather than >: Windows PowerShell 5 re-encodes what > writes (as UTF-16), while --out writes the command's bytes as they are. The command writes the same bytes on every platform, with lines ending in \n.
#Run it
Before running a deployment someone else made or changed, read Is it safe to run?: a deploy.json can start programs and write files outside its folder.
./elucid8 run plan.json --config deploy.json
{"name":"running","context":{"t":4},"outcome":{"kind":"value","value":13,"ts":0}}
One JSON line per point: the value, its coordinates and its outcome. 13 is the playground's answer.
To ask something else, give --query (it replaces the configuration's queries; repeat it for several). A query names a value and its coordinates; running[t = 4..5] is two points (a range includes both ends):
./elucid8 run plan.json --config deploy.json --query 'running[t = 4..5]' --query 'ratio[t = 3]'
{"name":"running","context":{"t":4},"outcome":{"kind":"value","value":13,"ts":0}}
{"name":"running","context":{"t":5},"outcome":{"kind":"value","value":22,"ts":0}}
{"name":"ratio","context":{"t":3},"outcome":{"kind":"error","error":"division","message":"division by zero","origin":{"name":"ratio","context":{"t":3}},"ts":0}}
These are the playground's answers: 13 and 22, and an error at t = 3, where x is 0. An error or eod is a result, not a failure: the command still exits with 0. To keep other queries, put them in "queries" in deploy.json.
For a plain table instead, add --format csv (or write to a file with --out results.csv):
./elucid8 run plan.json --config deploy.json --query 'running[t = 4..5]' --query 'ratio[t = 3]' --format csv
name,t,running_value,running_kind,running_message,ratio_value,ratio_kind,ratio_message
running,4,13,value,,,,
running,5,22,value,,,,
ratio,3,,,,,error division,division by zero
Each value's answers are in a column named after it, running_value and ratio_value, holding data alone, so a spreadsheet or pandas reads them as numbers; beside each, its kind (value, eod, or error and the error's kind) and an error's message. With --timestamps, a column running_ts (and ratio_ts) after each value's message holds its answer's timestamp: the time of the latest data it was computed from, in milliseconds, 0 here because data/x.csv has no times (Values and timestamps).
--format frame gives each query as one block instead of one line per point: its axes, a value per cell, a kind per cell (value, eod or error), the timestamps and the errors. ratio[t = 2..7] becomes one line holding six cells. The command reference describes the format, and Using eLucid8 from your code reads frames and tables into Python, NumPy, pandas and JavaScript.
#Check before you run: check and info
./elucid8 check reads the plan, the configuration and every data file, and checks every binding and query without computing anything:
./elucid8 check plan.json --config deploy.json
plan.json: plan version 26, 1 input, 0 outputs
input "x": data/x.csv (CSV), stored, version d20b5fc4a3d402cb; over t (whole numbers; 6 rows); a missing point is missing data (eod past the last row along t)
columns: t (coordinate), value (value)
ok
./elucid8 info lists what a plan declares and what a deployment must bind:
./elucid8 info plan.json
plan version 26, compiled by elucid8-ts/0.1.0, source hash 8a90ccdf249f8fde
dimensions:
t: whole numbers
inputs (give each channel an entry in "inputs"):
x = input("x", t : inf)
outputs (each written to <channel>.csv unless "outputs" says otherwise):
(none)
values:
running over (t)
ratio over (t)
#Change the data
Open data/x.csv in a plain-text editor (such as TextEdit after Format → Make Plain Text, or any code editor), change the row for t = 4 so that it reads 4,50, save it, and ask for running at t = 5:
./elucid8 run plan.json --config deploy.json --query 'running[t = 5]'
{"name":"running","context":{"t":5},"outcome":{"kind":"value","value":67,"ts":0}}
The plan is unchanged; only the data changed. Each data file's version is a fingerprint of its bytes, so check now shows a new version for x:
input "x": data/x.csv (CSV), stored, version 06b4278a9a51d047; over t (whole numbers; 6 rows); a missing point is missing data (eod past the last row along t)
To use your own data, replace data/x.csv with your own file in the same form (keep the header). The --report report.json option records the versions a run used, with its timings and counts.
#A data service
This program asks a data service about each reading and raises an alert:
-- Each reading asked of a data service; its deadline (20 ms) is in deploy.json.
x = input("x", t : 2)
sum_service = input("sum_service", a : inf, b : inf)
total = sum_service[a = x, b = 1]
alert = total > 5
In the playground, set the deadline of sum_service to 20 ms on its card in the Data In/Out tab, give the input x the table below and query alert at t = 1: it is true. Save it with the name Alert and press More ▾, then Download: your browser saves alert.zip.
t,value
0,2
1,7
Its configuration says that sum_service is answered on demand by the stand-in built into elucid8, which answers after the latency set in the playground (5 ms by default), and gives its deadline (deadlineMs):
{
"format": "elucid8-deploy/2",
"inputs": {
"x": {
"from": "data/x.csv"
},
"sum_service": {
"from": {
"builtin": "sum_service",
"latencyMs": 5
},
"kinds": {
"a": "real",
"b": "real"
},
"deadlineMs": 20
}
},
"queries": [
"alert[t = 1]"
]
}
Unzip it beside the first program, copy the command into its folder, and ask for both ticks:
cd ~/Downloads
unzip alert.zip
cp running-sum/elucid8 alert/
cd alert
./elucid8 run plan.json --config deploy.json --query 'alert[t = 0..1]' --format csv --timestamps
name,t,alert_value,alert_kind,alert_message,alert_ts
alert,0,false,value,,5
alert,1,true,value,,5
alert is false at t = 0 (2 + 1 = 3) and true at t = 1 (7 + 1 = 8); each answer carries the time it completed, 5 ms. Change latencyMs to 30 in deploy.json and run again. Both answers become late errors, because each question starts at 0 ms (its data has no timestamps) and its deadline counts from there; a late error carries the deadline's time, 20 ms:
name,t,alert_value,alert_kind,alert_message,alert_ts
alert,0,,error late,late (30 ms > deadline 20 ms),20
alert,1,,error late,late (30 ms > deadline 20 ms),20
An input's data can also be a JSON-lines file (one JSON object per line), and a real data service can be a separate program that holds its own credentials; the command reference shows both. The configuration names the program and, at most, the names of the environment variables it receives, never their values. To read from a database, an API or a stream, or send results to one, see Connecting eLucid8 to your data.
#3. The same engine as a WebAssembly module
The same runtime also builds as a WebAssembly module: the elucid8 command's engine, running in the browser. A page gives it a plan, a configuration and the data files' contents, and gets back exactly the lines elucid8 run prints. Nothing is sent anywhere: the module opens no files and makes no network requests.
It is built and tested with every release; a snippet to place on your own web page is not published yet. A page would use it roughly like this (a sketch, not a published API):
// A sketch of the module's use, not a published API.
const runtime = await Elucid8Wasm.compile(new Uint8Array(await (await fetch("elucid8.wasm")).arrayBuffer()));
const result = runtime.run(planText, configText, { "data/x.csv": csvText });
if (result.status === "done") show(result.output); // the line ./elucid8 run printed, as text
The configuration is the same deploy.json; the files are given by the names it uses. The result also says when the configuration is invalid, or when a query stopped with a program error. A service can be answered by the page itself (for example by asking the page's own server, which holds any key): the module asks for each call, and runs again with the answer.