Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/boblio-max/origin/llms.txt

Use this file to discover all available pages before exploring further.

Origin includes a built-in binary builder that compiles any .or script into a portable, self-contained executable. The output binary embeds the Python runtime, all standard library modules, and any third-party packages your script uses — so the target machine requires no Python installation whatsoever. This makes it straightforward to deploy Origin programs to production hardware, share tools with non-developers, or ship an application to a Raspberry Pi without managing dependencies on the device.

Build Command

origin build main.or
This command compiles main.or and writes the output binary into the same directory as the source file. On Windows the binary is named main.exe; on Linux and macOS it is named main with no extension.

How It Works

The builder (builder.py) performs four sequential steps every time you run origin build: Step 1 — Transpile the Origin script to Python source. The builder reads the .or file, runs it through the same lexer → parser → interpreter pipeline used by origin run, and captures the resulting Python source string. The working directory is temporarily set to the script’s own directory so that any relative import paths resolve correctly during transpilation. Step 2 — Write a bootstrap entry point. The transpiled Python is written into a temporary file named <base>_main.py inside a __origin_build__/ working directory. This file is prepended with the runtime imports that every Origin program relies on:
import math
import random
import sys
import os
try:
    import adafruit_servokit
except ImportError: pass

# Origin Runtime Globals
_origin_runtime_line = 0
The try/except guard around adafruit_servokit means hardware scripts compile successfully on any machine — even one without the Adafruit library installed — while the hardware control code remains intact for when the binary is deployed to a Pi. Step 3 — Invoke PyInstaller. The builder calls PyInstaller with the --onefile and --clean flags, pointing it at the generated _main.py entry point. PyInstaller bundles the Python interpreter, all imported modules, and the generated code into a single executable file. Step 4 — Place the output in the source directory. PyInstaller’s --distpath is set to the same directory as the original .or file, so the finished binary lands right next to your source with no hunting through dist/ folders.

Build Artifacts

PyInstaller uses __origin_build__/ as its working directory for intermediate files (build logs, .spec files, compiled .pyc objects). This directory is created fresh at the start of every build — if it already exists from a previous run it is deleted and recreated — so stale artifacts never accumulate silently.
my_project/
├── main.or
├── main.exe          ← output binary (Windows)
└── __origin_build__/ ← PyInstaller working directory
    ├── main.spec
    └── build/

Requirements

PyInstaller must be installed in the same Python environment that runs the origin command:
pip install pyinstaller
The builder locates the pyinstaller executable automatically by looking next to the active Python interpreter (os.path.dirname(sys.executable)), so no manual path configuration is needed as long as you install into the correct environment.

Platform Notes

PlatformOutput filenameNotes
Windowsmain.exeExtension added automatically
LinuxmainNo extension; mark executable with chmod +x if needed
macOSmainNo extension; Gatekeeper may require xattr -d com.apple.quarantine main
The binary is compiled for the architecture of the machine running the build. Build on a Raspberry Pi (ARM) to produce an ARM binary for deployment to other Pi devices; build on Windows x64 to produce a Windows executable.
Building on a Raspberry Pi produces an ARM binary that will not run on x86/x64 machines, and vice versa. If you need to target multiple platforms, run origin build separately on each target architecture or use a cross-compilation environment.

Build and Deploy Workflow

1

Write your Origin script

Create your .or file as normal. Hardware commands, py blocks, parallel sections, and imports are all supported.
let message: str = "Deployed with Origin!"
print message

set pin 17, 1
2

Run the builder

From the directory containing your script, run:
origin build main.or
The builder prints its progress as it transpiles and bundles:
[*] Transpiling main.or...
[*] Bundling into main.exe...
[+] Successfully built: /path/to/project/main.exe
3

Copy the binary to the target machine

Transfer the single output file to the deployment target — a Raspberry Pi, a server, a colleague’s machine — using scp, a USB drive, or any other method.
scp main pi@raspberrypi.local:/home/pi/
4

Run it — no Python required

Execute the binary directly on the target machine. No Python installation, no pip install, no .or source files needed.
./main
The --clean flag is already included in every origin build invocation. It forces PyInstaller to discard any cached analysis from previous builds before starting, which prevents subtle bugs caused by stale import graphs or outdated .pyc files. You never need to manually clear the PyInstaller cache when building Origin scripts.

Build docs developers (and LLMs) love