Origin includes a built-in binary builder that compiles anyDocumentation 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.
.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
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:
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.
Requirements
PyInstaller must be installed in the same Python environment that runs theorigin command:
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
| Platform | Output filename | Notes |
|---|---|---|
| Windows | main.exe | Extension added automatically |
| Linux | main | No extension; mark executable with chmod +x if needed |
| macOS | main | No extension; Gatekeeper may require xattr -d com.apple.quarantine main |
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
Write your Origin script
Create your
.or file as normal. Hardware commands, py blocks, parallel sections, and imports are all supported.Run the builder
From the directory containing your script, run:The builder prints its progress as it transpiles and bundles:
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.