# Elide documentation > Elide is a high-performance runtime and toolchain for Kotlin, Java, JavaScript, TypeScript and Python. This file contains every page of https://elide.help in navigation order. Each page starts with its title and URL; the index is https://elide.help/llms.txt. # Elide Overview URL: https://elide.help/ > Install Elide, run your first program, and find guides and references for JavaScript, TypeScript, Python, Java, Kotlin and WebAssembly. Run JavaScript, TypeScript, Python, Java, Kotlin and WebAssembly with Elide. Use its built-in tools to install dependencies, build projects and run tests. ## Start here 1. [Install Elide](https://elide.help/docs/installation). 2. Pick a first-program guide: [JavaScript and TypeScript](https://elide.help/docs/web), [Python](https://elide.help/docs/python), [Java and Kotlin](https://elide.help/docs/jvm), or [WebAssembly](https://elide.help/docs/wasm). Already have a project? [Choose how to use it with Elide](https://elide.help/docs/getting-started#use-an-existing-project): keep your build tools, migrate a JVM build, or run scripts from an existing manifest. ## Common commands ```bash elide run app.ts # run a file elide python script.py # run Python with CPython-style arguments elide repl # interactive REPL elide init # start a new project from a template elide adopt # migrate an existing project with an AI coding agent elide install # install Maven dependencies elide install --ecosystems=npm # install npm dependencies elide build # build the project elide test # run tests elide format -- src # format Java and Kotlin sources elide serve --no-tui ./dist # serve a directory over HTTP elide --help-all # every command and flag elide help # any page of these docs, in the terminal ``` ## Build and integrate - [Project setup](https://elide.help/docs/projects) - [Adopt an Existing Project](https://elide.help/docs/toolchain/usage/adopt) - [Build an HTTP service](https://elide.help/docs/http-service) - [IDE integration](https://elide.help/docs/ide) - [Build tool integration](https://elide.help/docs/build-tools) - [Work with coding agents](https://elide.help/docs/agentic-engineering) - [Troubleshooting](https://elide.help/docs/troubleshooting) ## Reference and comparisons - [Code samples](https://elide.help/docs/code-samples) - [CLI Reference](https://elide.help/docs/cli-references) - [Compatibility Matrix](https://elide.help/docs/compatibility) - [API Overview](https://elide.help/docs/api-overview) - Coming from another runtime: [Node](https://elide.help/docs/elide-for-node), [Bun](https://elide.help/docs/elide-for-bun), [Deno](https://elide.help/docs/elide-for-deno), [Python](https://elide.help/docs/elide-for-python), [Java](https://elide.help/docs/elide-for-java), [Kotlin](https://elide.help/docs/elide-for-kotlin) ## Documentation, even offline Run `elide help` to browse and search this manual without a network connection. --- # Installation URL: https://elide.help/docs/installation > Install Elide on macOS, Linux, WSL or Windows with the install script, PowerShell or a package manager, pick a release channel, and add Python. Choose the installer for your operating system. The scripts install the latest release by default; pass `--channel=nightly` for daily builds. Check [system requirements](#system-requirements) before installing. Already installed? [Run your first program](https://elide.help/docs/getting-started). For Python, use the install script with `--with-python`, Homebrew, or a container. The package installers do not include Python; see [Python](#python). ## macOS, Linux, or WSL ```bash curl -sSL --tlsv1.2 elide.sh | bash ``` Installs under `${ELIDE_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/elide}` and adds `bin` to your shell profile. Pass options after `bash -s --`: ```bash curl -sSL --tlsv1.2 elide.sh | bash -s -- --channel=nightly --with-python ``` | Option | Effect | | --- | --- | | `--channel=release` or `--channel=nightly` | Select the channel (default `release`). | | `--install-rev=VERSION` | Install a specific version. | | `--install-dir=PATH` | Install somewhere else. | | `--with-python` | Also install the Python component. | | `--libc=glibc` or `--libc=musl` | Pick the Linux `amd64` build (default: detected, see [System requirements](#system-requirements)). | | `--no-path` | Leave shell profiles unchanged. | | `--help` | List every option without installing. | ## Windows Run this in PowerShell. For WSL, use the [Linux command](#macos-linux-or-wsl) inside your WSL terminal. ```powershell & ([scriptblock]::Create((irm https://elide.sh/install.ps1))) ``` Installs under `$env:ELIDE_HOME`, or `$env:LOCALAPPDATA\elide` when that is unset. Options: `-Channel`, `-InstallRev`, `-InstallDir`, `-WithPython`, and `-NoPath`. ## Python Python is an optional component: ```bash elide setup python ``` | Install method | Python | | --- | --- | | Install script | `--with-python` (`-WithPython` on Windows), or `elide setup python` later | | Homebrew | Included | | Container images | Included | | apt, RPM, MSI, macOS installers | Not available; use one of the methods above | `elide setup python` uses the binary's own channel; `--channel=release` or `--channel=nightly` overrides it. ## Other methods - [Packages & Installers](https://elide.help/docs/installation/packages): Homebrew, apt, RPM, macOS and Windows installers - [Container Images](https://elide.help/docs/installation/containers) - [Continuous Integration](https://elide.help/docs/installation/ci-cd) - [GitHub Releases](https://github.com/elide-dev/elide/releases): archives, checksums, and older builds. Keep an archive's `bin/` and `lib/` together; `bin/elide` needs `lib/`. Update a script install with `elide upgrade`, and a package-manager install through its manager. ## Verify the install ```bash elide --version elide info ``` Verifying an Elide installation from the command line `elide info` lists the available languages, including `python` when it is installed. If the shell cannot find `elide`, open a new terminal or add the install's `bin` folder to `PATH`. **Next: [run your first program](https://elide.help/docs/getting-started)** in JavaScript or TypeScript, Python, or Java and Kotlin. If Python is missing, follow [the component setup](https://elide.help/docs/troubleshooting#python-is-not-installed). ## System requirements | Platform | Architecture | Minimum | Python component | | --- | --- | --- | --- | | Linux | `amd64` | glibc 2.17, kernel 4.18 | Yes | | Linux, static musl build | `amd64` | kernel 4.18 | No | | Linux | `arm64` | glibc 2.17, kernel 4.18 | Yes | | macOS | Apple Silicon (`arm64`) | macOS 11 | Yes | | Windows | `amd64` | — | Yes | - glibc 2.17 covers RHEL and CentOS 7, Amazon Linux 2, Ubuntu 14.04, Debian 8 and later; the kernel must also be 4.18 or newer. - The static musl build (`elide.linux-amd64-musl.*` on [GitHub Releases](https://github.com/elide-dev/elide/releases)) runs on any `amd64` Linux, including Alpine. It runs JavaScript, TypeScript and WebAssembly, and compiles Java and Kotlin; it includes no Python and no JDK, so `elide java` runs programs on an installed JDK (`JAVA_HOME` or `java` on `PATH`), and `elide native-image` needs an installed `native-image`. The install script picks it on musl hosts; `--libc=glibc` or `--libc=musl` overrides the choice. - On `arm64`, musl is not supported (`exec elide: no such file or directory`); use a [container image](https://elide.help/docs/installation/containers) there. - Intel Macs are not supported. Check your glibc with: ```bash ldd --version | head -1 ``` --- # Getting started URL: https://elide.help/docs/getting-started > Choose a JavaScript, TypeScript, Python, Java, Kotlin or WebAssembly quickstart, or bring an existing project to Elide. Choose the language you want to use. Each quickstart takes you from installation to a running program and its next steps. ## Install [Install Elide](https://elide.help/docs/installation) for your operating system, then open a new terminal and check: ```bash elide --version ``` If the shell cannot find `elide`, follow [Verify the install](https://elide.help/docs/installation#verify-the-install). Python also needs the [Python component](https://elide.help/docs/installation#python). ## Run a file | Language | Start here | You'll do | | --- | --- | --- | | JavaScript or TypeScript | [JavaScript and TypeScript quickstart](https://elide.help/docs/web) | Run a file, import an npm package and run a test. | | Python | [Python quickstart](https://elide.help/docs/python) | Add Python, run a standard-library program and test it with unittest. | | Java or Kotlin | [Java and Kotlin quickstart](https://elide.help/docs/jvm#run-your-first-program) | Run source, create a project, resolve Maven dependencies and run JUnit tests. | | WebAssembly | [WebAssembly guide](https://elide.help/docs/wasm) | Run a WASI module or load a module from JavaScript. | ### Executable scripts To run a file directly from your shell, follow [Executable scripts](https://elide.help/docs/web#executable-scripts). ## Create a project The language quickstarts above show the files you need. For scripts, workspaces and a shared `elide.pkl` manifest, continue to [Project setup](https://elide.help/docs/projects). ### Use an existing project - **Node, Bun or Deno:** check the [Node](https://elide.help/docs/elide-for-node), [Bun](https://elide.help/docs/elide-for-bun) or [Deno](https://elide.help/docs/elide-for-deno) migration guide for command changes and API limits before running the app. - **Java or Kotlin:** [keep Maven, Gradle or Bazel and use Elide's tools](https://elide.help/docs/build-tools), or [migrate the build to Elide](https://elide.help/docs/toolchain/usage/adopt). - **Python:** check [Python compatibility and command changes](https://elide.help/docs/elide-for-python), then [run your project's entry point](https://elide.help/docs/python-toolchain#run-project-scripts). ## Add a dependency Choose the command for your ecosystem: [npm](https://elide.help/docs/web#npm-packages), [Maven](https://elide.help/docs/toolchain/jvm/maven), or [Python packages](https://elide.help/docs/python-packages). Plain `elide install` installs Maven dependencies; npm requires `elide install --ecosystems=npm`. ## Test Use `elide test` for [JavaScript and TypeScript](https://elide.help/docs/web#tests) or [JUnit](https://elide.help/docs/toolchain/testing). For Python, [run unittest or pytest as a module](https://elide.help/docs/python-testing); `elide test` does not discover Python tests. ## Build JavaScript, TypeScript and Python source files run directly. For a project with build tasks, `elide build` writes outputs and build state to `.dev/`. See [Build tasks](https://elide.help/docs/toolchain/build-tasks) and [JVM packaging](https://elide.help/docs/toolchain/jvm/jar). ## Next steps - [Build an HTTP service](https://elide.help/docs/http-service): a working server and framework compatibility. - [Code samples](https://elide.help/docs/code-samples): examples with their expected output. - [Troubleshooting](https://elide.help/docs/troubleshooting): exact error messages and recovery steps. --- # Adopt an existing project URL: https://elide.help/docs/toolchain/usage/adopt > Migrate a Java, Kotlin or Spring Boot project from Maven or Gradle to Elide with `elide adopt`: what it runs, its flags and exit codes, which projects it fits, and a worked example. `elide adopt` starts an AI coding harness (Codex, Claude Code or OMP) in the current directory with a built-in migration prompt. The harness reads the build, edits files and runs Elide; Elide edits nothing itself. The prompt targets Java and Kotlin projects built with Maven or Gradle, especially Spring Boot, and tells the harness to keep any other languages working. ```shell elide adopt ``` `elide adopt` migrates the build to `elide.pkl`. To keep Maven, Gradle or Bazel and use Elide's compilers inside them, see [Build tool integration](https://elide.help/docs/build-tools). ## Which projects it fits | Project | Fit | Why | | --- | --- | --- | | Single-module Java or Kotlin app on Maven or Gradle | Good | Dependencies, source layout, tests and JAR map onto `elide.pkl`. Tested. | | Spring Boot application or service | Good | The prompt checks the main class, Spring dependencies and plugins, resources, tests and packaging. Tested. | | A JVM build you want to keep, using Elide only to run and compile | Good | Choose **Existing build**: no `elide.pkl` is required. | | Multi-module builds | Untested | Elide [workspaces](https://elide.help/docs/elide-pkl-reference#workspaces) exist, but the prompt is not evaluated on them. | | Heavy custom plugins, generated sources, unusual annotation processing | Poor | The harness keeps Maven or Gradle for steps Elide does not replace; expect a partial migration. | | Android | Untested | The prompt is not evaluated on Android builds. | | JavaScript, TypeScript or Python only | Not needed | Elide runs `package.json` scripts, `pyproject.toml` entry points and `node:test` files without a migration; see [Project Setup](https://elide.help/docs/projects). | ### Tested projects These shapes pass `elide install`, `elide build`, `elide test`, startup and the original build, starting from a fresh checkout, with the Codex harness: | Project shape | Existing build | Tested on | | --- | --- | --- | | Java, Spring Boot application | Maven | Spring Petclinic: dependencies, resources, tests, runnable app, JAR | | Java, Spring Boot service | Gradle | Spring REST service: dependencies, resources, tests, HTTP readiness | | Kotlin/JVM command-line app | Gradle Kotlin DSL | Single module with Kotlin serialization and coroutines | The Claude Code harness is shown on the Kotlin app in the [worked example](#worked-example). ## Before you start 1. Install and sign in to a harness. Elide runs it from `PATH`: | Choice | Executable | Harness | | --- | --- | --- | | `codex` | `codex` | OpenAI Codex CLI | | `claude` | `claude` | Claude Code | | `omp` | `omp` | OMP | 2. Commit the project, so the migration is one reviewable diff. 3. Build it once with Maven or Gradle, so there is a known-good baseline. 4. `cd` into the project, or pass `-p DIR`. ## Run interactively `elide adopt` asks three questions, then starts the harness. Flags answer a question in advance. | Question | Answers | Flag | | --- | --- | --- | | Use elide build with an elide.pkl project manifest? | Yes (default): **Elide build**. No: **Existing build** | `--build elide`, `--build existing` | | Which AI coding harness should perform the migration? | `codex`, `claude`, `omp` | `--harness` | | How should the harness approve tool calls? | `auto-approve`, `manual-approve`, `yolo` | `--approval` | ```shell elide adopt --build elide --harness claude ``` Esc on a question exits `0` without starting the harness. Ctrl+C stops the harness and exits `130`. ### Build strategy | Strategy | The prompt tells the harness to | | --- | --- | | **Elide build** | Write `elide.pkl`: keep `src/main`/`src/test` without declaring source sets, keep dependency versions and scopes, set the Java target and release, define the JAR with its main class. Keep Maven or Gradle until a final `elide install`, `elide build`, `elide test`, `elide run` and the original build all pass. | | **Existing build** | Keep Maven or Gradle as the build; use Elide's runtime and tools only where they help; not create `elide.pkl` just for `elide build`. | Both end with a summary of changed files, the validation run, and anything left to do. ### Approval mode | Mode | Codex | Claude Code | OMP | Use for | | --- | --- | --- | --- | --- | | `auto-approve` | `--approve-for-me` | `--permission-mode auto` | `--auto-approve` | A committed worktree you will review. | | `manual-approve` | (no flag) | `--permission-mode manual` | `--approval-mode=always-ask` | Unfamiliar or sensitive repositories. | | `yolo` | `--dangerously-bypass-approvals-and-sandbox` | `--permission-mode bypassPermissions` | `--approval-mode=yolo` | Disposable environments without secrets. | With `auto-approve` or `yolo`, Elide runs the harness in batch mode (`codex exec --skip-git-repo-check`, `claude --print`, `omp --print`) and shows a progress line; `--log` also streams the harness output. With `manual-approve`, the harness runs interactively and its output is always shown. ## Run without questions ```shell elide adopt \ --build elide \ --harness codex \ --approval auto-approve \ --non-interactive ``` `--non-interactive` requires `--build`, `--harness` and `--approval`; a missing one exits `2`. It refuses `manual-approve`. Without a terminal, `elide adopt` exits `1` unless `--non-interactive` and all three are given. ## Add guidance `--prompt-append FILE` adds a UTF-8 file to the end of the prompt under `Additional adoption guidance:`. Repeat it to add several, in order: ```shell elide adopt --prompt-append ./adoption-guidance.md --prompt-append ./team-rules.md ``` Use it for facts the harness cannot infer: internal repositories, which build to keep, commands that must keep working. ## Output and exit codes The harness's edits are the only output in the project. On the [worked example](#worked-example) that was a new `elide.pkl` and `.gitignore` entries for `.dev/`. Elide prints `Adoption log: PATH` before starting; the log is kept at `.dev/logs/adopt--.log` in the project. | Exit code | Meaning | | --- | --- | | `0` | The harness exited `0`, or a question was cancelled. | | `1` | The harness failed (`Error: claude exited unsuccessfully (exit status: 3)`), could not start (`Error: failed to launch codex: No such file or directory`), a `--prompt-append` file is unreadable, or there is no terminal. | | `2` | A flag is missing or invalid. | | `130` | Interrupted with Ctrl+C. | ## Validate the migration Exit `0` means the harness finished, not that the migration is correct. Review the diff: dependency versions, source and resource directories, entry point, tests and packaging. Then run: ```shell elide install elide build elide test elide run ``` Run the original Maven or Gradle build too, while it exists. If the result is wrong, revert, add guidance with `--prompt-append`, and run again. ## Worked example A single-module Kotlin command-line app built with Gradle Kotlin DSL: Kotlin 2.3.20, JVM 17, `kotlinx-coroutines-core` 1.10.2, `kotlinx-serialization-json` 1.9.0 and one `kotlin("test")` test. Committed, then: ```shell elide adopt --build elide --harness claude --approval auto-approve --non-interactive ``` ```terminaloutput Adoption log: /path/to/project/.dev/logs/adopt-1767225600-973648.log [3m 56s] ✓ Project adopted in 3m 56s ``` The harness added `elide.pkl` and a `.gitignore`, and changed nothing else. The manifest keeps the Gradle versions and moves the rest into Elide's terms: ```pkl amends "elide:project.pkl" import "elide:Jvm.pkl" as Jvm import "elide:Kotlin.pkl" as Kotlin name = "kotlinx-cli" version = "1.0.0" dependencies { maven { packages { "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.2" "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0" // Gradle mediates annotations to 23.0.0 (via coroutines); Elide's nearest-wins picks 13.0. "org.jetbrains:annotations:23.0.0" } testPackages { // Gradle's `kotlin("test")` with `useJUnitPlatform()` resolves to the JUnit 5 variant. "org.jetbrains.kotlin:kotlin-test-junit5:2.3.20" // The JUnit launcher; with `testing = false`, Elide does not bundle one. "org.junit.platform:junit-platform-console:1.10.1" } } } jvm { main = "dev.elide.samples.MainKt" target = 17 features { // JUnit comes from testPackages above, as with Gradle's `kotlin("test")`; Elide's bundled JUnit is off. testing = false } java { source = 17 release = 17 } } kotlin { // Matches the Kotlin Gradle plugin version in build.gradle.kts. toolchain = new Kotlin.ManagedKotlinToolchain { version = "2.3.20" } compilerOptions { jvmTarget = 17 } features { // KotlinX libraries are declared explicitly above, at the versions Gradle uses; only the // serialization compiler plugin (Gradle's `plugin.serialization`) is enabled. kotlinx = false serialization = true coroutines = false atomicfu = false powerAssert = false metro = false reflection = false } } artifacts { ["jar"] = new Jvm.Jar { name = "kotlinx-cli" main = "dev.elide.samples.MainKt" } } ``` Validation from a clean `.dev/`: ```terminaloutput $ elide install [504ms] ✓ Resolved 25 Maven dependencies (476ms) [505ms] ✓ Dependencies installed in 484ms $ elide test 1 pass 0 skip 0 fail Ran one test across one file. (0.57s) $ elide run [ 16ms] ⇥ Dependencies ready (Up to date) [ 16ms] ⇥ Kotlin main compilation skipped (Up to date) [ 16ms] ⇥ Java main compilation skipped (Up to date) [ 17ms] ⇥ Packaging jar 'jar' skipped (Up to date) {"completed":["PARSE","EMIT"]} [138ms] ✓ JVM jar application completed successfully (121ms) [139ms] ✓ Build successful in 126ms ``` `elide build` produced `.dev/artifacts/jar/kotlinx-cli/kotlinx-cli.jar`, and `gradle build` still passed. ## See also - [Project Setup](https://elide.help/docs/projects) and the [elide.pkl reference](https://elide.help/docs/elide-pkl-reference) - [Elide for Java users](https://elide.help/docs/elide-for-java), [Elide for Kotlin users](https://elide.help/docs/elide-for-kotlin) - [`elide adopt` flags](https://elide.help/docs/cli-references#adopt) --- # JavaScript and TypeScript with Elide URL: https://elide.help/docs/web > Run your first TypeScript program, install and import an npm dependency, and test it with node:test; no compile step or tsconfig.json. Elide runs JavaScript and TypeScript directly, with CommonJS, ES modules, and a subset of the Node and Web APIs. This quickstart builds a small greeting program, adds an npm dependency, and tests the greeting. Bringing an existing app? Start with [Elide for Node users](https://elide.help/docs/elide-for-node) and the [framework compatibility table](https://elide.help/docs/http-service#frameworks). ## Install [Install Elide](https://elide.help/docs/installation), open a new terminal, then check: ```bash elide --version ``` If the command is not found, follow [Verify the install](https://elide.help/docs/installation#verify-the-install). ## Run a file > [!TIP] TypeScript runs as written > No compile step and no `tsconfig.json`: `elide app.ts` runs the file. ```bash mkdir hello-elide cd hello-elide ``` Save this as `app.ts`: ```ts const name: string = "Ada"; console.log(`Hello, ${name}!`); ``` ```bash elide run app.ts ``` ```terminaloutput Hello, Ada! ``` You can also use `elide app.ts`. For JavaScript, remove `: string` and save the file as `app.js`. Running a TypeScript file directly with Elide ## npm packages Create `package.json` in the same directory: ```json { "type": "module", "dependencies": { "zod": "3.24.1" } } ``` Install the dependency: ```bash elide install --ecosystems=npm ``` Plain `elide install` installs Maven dependencies and skips npm. If an import cannot find its package, check [Module not found after `elide install`](https://elide.help/docs/troubleshooting#module-not-found-after-elide-install). Save the greeting logic as `greeting.ts`: ```ts import { z } from "zod"; const User = z.object({ name: z.string() }); export function greeting(user: unknown): string { return `Hello, ${User.parse(user).name}!`; } ``` Replace `app.ts` with: ```ts import { greeting } from "./greeting.ts"; console.log(greeting({ name: "Ada" })); ``` ```bash elide run app.ts ``` ```terminaloutput Hello, Ada! ``` This confirms the installed package imports and validates the input. Installing npm dependencies and importing them from TypeScript Packages go into `node_modules`. If the project also has Maven dependencies, use `--ecosystems=maven,npm` or `--workspace`. Lockfiles and options: [NPM Installer](https://elide.help/docs/toolchain/web/npm). ## Tests Create `greeting.test.ts` beside the other files. `elide test` discovers `*.test.ts` files and runs `node:test` tests: ```ts import test from "node:test"; import assert from "node:assert"; import { greeting } from "./greeting.ts"; test("greets a named user", () => { assert.equal(greeting({ name: "Ada" }), "Hello, Ada!"); }); test("rejects a user without a name", () => { assert.throws(() => greeting({})); }); ``` ```bash elide test ``` Both tests should pass. If no tests are found, check the filename and run the command from `hello-elide`. More discovery rules and runner options: [Testing](https://elide.help/docs/toolchain/testing). ## Servers Continue with [Build an HTTP service](https://elide.help/docs/http-service) for a complete server you can run and query. For an existing directory of web files: ```bash elide serve --no-tui ./dist # static files on 127.0.0.1:8080 elide dev --no-tui ./src # port 3000; pages reload on change ``` Given a script, `serve` and `dev` run it; a module that exports a `fetch` handler is served directly. See [Development Server](https://elide.help/docs/dev-server). ## Executable scripts On macOS and Linux, start a file with `#!/usr/bin/env elide` and mark it executable: ```ts #!/usr/bin/env elide const name: string = process.argv[2] ?? "world"; console.log(`Hello, ${name}!`); ``` Save it as `hello.ts`, then run: ```bash chmod +x hello.ts ./hello.ts Ada ``` The output is `Hello, Ada!`. The same first line works for `.js`, `.mjs` and `.py` files. ## Samples - [TypeScript without a build](https://elide.help/docs/code-samples#typescript-without-a-build) - [HTTP handler](https://elide.help/docs/code-samples#http-handler) - [TypeScript tests](https://elide.help/docs/code-samples#typescript-tests) - [Local server and fetch](https://elide.help/docs/code-samples#local-server-and-fetch) ## More Extensions: `.js`, `.mjs`, `.cjs`, `.jsx`, `.ts`, `.mts`, `.cts`, `.tsx`. JSX and TSX are transformed; install the runtime they import, such as `react/jsx-runtime`. Elide provides no UI framework or DOM. See [TypeScript and modules](https://elide.help/docs/typescript-and-modules) for module resolution and type checking. Implemented Node and Web modules: [API Overview](https://elide.help/docs/api-overview). SQLite, PostgreSQL and MySQL drivers: [Databases](https://elide.help/docs/api-database). Measured results: [Compatibility Matrix](https://elide.help/docs/compatibility). Traces, metrics, and logs through `@opentelemetry/api`, with no SDK: [OpenTelemetry in JavaScript](https://elide.help/docs/opentelemetry/javascript). --- # Python with Elide URL: https://elide.help/docs/python > Add Python to Elide, run a Python 3.13 program with the standard library, and test it with unittest; then add packages or JavaScript interop. Python support is experimental. This quickstart runs a program using the bundled standard library, then tests it with unittest. No third-party packages are needed. > [!TIP] No CPython install > Elide runs Python 3.13 and its standard library itself. ## Install [Install Elide](https://elide.help/docs/installation) using a method that [supports Python](https://elide.help/docs/installation#python), then add the Python component if it is not already included: ```bash elide setup python elide info ``` `elide info` should list `python` on its `Languages:` line. If the shell cannot find `elide`, follow [Verify the install](https://elide.help/docs/installation#verify-the-install). If Python support is missing, see [Python is not installed](https://elide.help/docs/troubleshooting#python-is-not-installed). `elide setup python --channel=release` or `--channel=nightly` picks the channel; `--force` reinstalls the component. ## Run Python Create a directory for this example: ```bash mkdir hello-python cd hello-python ``` Save this as `greeting.py`: ```python import json def greeting(name: str) -> str: return f"Hello, {name}!" if __name__ == "__main__": print(json.dumps({"message": greeting("Ada")})) ``` ```bash elide python greeting.py ``` ```terminaloutput {"message": "Hello, Ada!"} ``` The `json` import uses the standard library included with the Python component. ## Tests Create `test_greeting.py` in the same directory: ```python import unittest from greeting import greeting class GreetingTest(unittest.TestCase): def test_names_the_caller(self): self.assertEqual(greeting("Ada"), "Hello, Ada!") ``` Run unittest as a module: ```bash elide python -m unittest -v test_greeting ``` The runner should report one test and `OK`. If it cannot import `greeting` or `test_greeting`, check the filenames and run the command from `hello-python`. `elide test` does not discover Python tests. For discovery across several files or pytest, see [Python tests](https://elide.help/docs/python-testing). ## Next steps - [Add packages](https://elide.help/docs/python-packages): install dependencies with the optional Python package tooling, or use a compatible external virtual environment. - [Run a project entry point](https://elide.help/docs/python-toolchain#run-project-scripts): use the scripts in `pyproject.toml`. - [Call JavaScript from Python](#javascript-interop): share values between languages. - [Check compatibility](#known-limitations) before moving an existing application. ## Command-line arguments `elide python` takes Python interpreter arguments before the script or module. For an existing `app.py`: ```bash elide python app.py --name Elide --count 2 # sys.argv: ['app.py', '--name', 'Elide', '--count', '2'] elide python -c 'import sys; print(sys.version)' elide python -m json.tool input.json echo 'print("from stdin")' | elide python - ``` Tokens after the script, `-c CMD`, or `-m MODULE` go to the program. Bare `elide python` starts the REPL in a terminal and reads standard input otherwise. Running a Python program with command-line arguments in Elide The general commands run `.py` files with the same `sys.argv`: ```bash elide app.py elide run app.py elide -l python -s 'print(1 + 1)' ``` ### Interpreter options Put these before the script, `-c`, or `-m`. `elide --help-all` lists them under "Python interpreter options". | Flag | Effect | | --- | --- | | `-c CMD` | Run `CMD` as the program; trailing tokens become `sys.argv[1:]`. | | `-m MODULE` | Run a library module as `__main__`. | | `-s` | Don't add the user site directory to `sys.path`. | | `-I` | Isolated mode. | | `-E` | Ignore `PYTHON*` environment variables. | | `-S` | Don't `import site` on startup. | | `-P` | Don't prepend a potentially unsafe path to `sys.path`. | | `-B` | Don't write bytecode files. | | `-u` | Unbuffered standard output and error. | | `-O` | Optimization level; repeat for `-OO`. | | `-b` | Warn on `bytes`/`str` comparisons; repeat to raise errors. | | `-W ARG` | Warning control; repeatable. | | `-x` | Accepted for compatibility; no effect. | Two flags are on by default: `-S`, because Elide builds `sys.path` itself and skips `site` for startup time, and `-B`. `sys.flags` reports both. To import `site` (`.pth` files, `sitecustomize`), pass `-X polyglot.python.NoSiteFlag=false`; to write bytecode, pass `-X polyglot.python.DontWriteBytecodeFlag=false`. ## Standard library The standard library includes `json`, `pathlib`, `sqlite3`, `ssl`, `zlib`, and `ctypes`. `bz2` and `lzma` need no system `libbz2` or `liblzma`. For the database drivers Elide includes, see [Databases](https://elide.help/docs/api-database). ## JavaScript interop With `--interop`, Python evaluates JavaScript through the built-in `elide` module: ```python # sum.py from elide import js print(js("[1, 2, 3].reduce((a, b) => a + b, 0)")) ``` ```bash elide --interop python sum.py ``` JavaScript and TypeScript import a Python module's default export: ```javascript // main.mjs import mod from "./mod.py"; console.log(mod.hello()); ``` ```bash elide --interop run main.mjs ``` Without `--interop`, these calls fail. See [Languages and Interop](https://elide.help/docs/languages). ## Third-party packages Package installation requires pytools, the optional package tooling installed with the Python component. Use `elide uv install PACKAGE`, or `elide install --ecosystems=pypi` for declared dependencies. Plain `elide install` retains its Maven default. Packages installed through Elide use the project's automatic environment. A compatible Python 3.13 external virtual environment can also supply packages through `VIRTUAL_ENV`. Only compatible wheels can be installed; source builds and arbitrary CPython native wheels are not supported. See [Packages and virtual environments](https://elide.help/docs/python-packages) for setup, commands and limitations. ## Tracing and metrics The `opentelemetry` API and `logging` export traces, metrics, and logs through Elide, with no SDK installed; see [OpenTelemetry in Python](https://elide.help/docs/opentelemetry/python). ## Known limitations - **C extensions**: some C extension modules do not load. - **macOS**: native module isolation is not available. - **WebAssembly SIMD**: installing Python disables it; see [WebAssembly with Elide](https://elide.help/docs/wasm#limits). - **CPython differences**: some edge cases behave differently from CPython 3.13; see the [Compatibility Matrix](https://elide.help/docs/compatibility). ## Samples - [Python calling JavaScript](https://elide.help/docs/code-samples#python-calling-javascript) - [JavaScript importing Python](https://elide.help/docs/code-samples#javascript-importing-python) - [Python script](https://elide.help/docs/code-samples#python-script) --- # Java and Kotlin with Elide URL: https://elide.help/docs/jvm > Run Java and Kotlin source files with Elide, use the bundled JDK 25 and Kotlin tools, resolve Maven dependencies, and build and test a project. Elide compiles, formats, builds, and tests Java (up to JDK 25) and Kotlin (2.5.0-Beta2), and resolves Maven dependencies. > [!TIP] No JDK to install > The JDK and Kotlin tools ship with Elide; no separate JDK, Kotlin compiler or build tool is needed. ## Run your first program [Install Elide](https://elide.help/docs/installation), then choose a template below. Each creates a new project directory with a program and a test. ### Kotlin ```bash mkdir hello-kotlin cd hello-kotlin elide init --plain --skip-defaults --skip-run --template ktjvm elide run ``` Edit `src/main/com/example/Hello.kt`, then run `elide run` again. ### Java ```bash mkdir hello-java cd hello-java elide init --plain --skip-defaults --skip-run --template java elide run ``` Edit `src/main/com/example/Hello.java`, then run `elide run` again. Both programs print: ```text Hello Elide! ``` Run the generated test with `elide test`. To use a library, declare its [Maven dependency](https://elide.help/docs/toolchain/jvm/maven) in `elide.pkl`, then: ```bash elide install elide test elide run ``` Already have a project? [Keep Maven/Gradle](https://elide.help/docs/build-tools) and use Elide's compiler or JDK, or [migrate your build](https://elide.help/docs/toolchain/usage/adopt) to `elide.pkl`. ## Run a source file A file with a `main` entrypoint compiles and runs directly: ```bash elide run Hello.java elide run Hello.kt ``` ## Use individual tools `elide java`, `elide javac`, `elide kotlinc`, and `elide jar` work like the tools they name. Arguments go after `--`: ```bash elide javac -- -d target src/main/java/app/Main.java elide kotlinc -- -d target src/main/kotlin/app/Main.kt elide java -- -cp target app.Main ``` `elide format` formats Java with Google Java Format and Kotlin with ktfmt: ```bash elide format -- src # rewrite files elide format --list-files -- --dry-run src # list files that would change; exit 1 if any ``` ## Start a project ```bash elide init --plain --skip-defaults --template java ``` | Template | Creates | | --- | --- | | `java` | A Java project. | | `ktjvm` | A Kotlin project. | | `workspace` | A Kotlin library and an app that depends on it. | To migrate a Maven or Gradle project, `elide adopt` runs an AI coding agent; see [Adopt an Existing Project](https://elide.help/docs/toolchain/usage/adopt). ## Build a project ```bash elide install # resolve Maven dependencies elide build # compile and assemble artifacts elide test # run JUnit tests elide run # run the project's main class ``` Elide projects — build, run, and reuse cached work `elide build --inspect` lists the project's tasks. Manifest: [Project setup](https://elide.help/docs/projects). Compiler and packaging options: [JVM Toolchain](https://elide.help/docs/toolchain/jvm). ## What programs can use The JDK, the Kotlin standard library, bundled kotlinx libraries, JUnit for tests, and Elide's annotations; there is no Elide runtime API and no calls into JavaScript or Python. See [JVM APIs](https://elide.help/docs/api-jvm). For a database, add its JDBC driver as a Maven dependency ([Databases](https://elide.help/docs/api-database#other-languages)); to share a library, see [Maven publishing](https://elide.help/docs/toolchain/jvm/publishing). ## Tracing and metrics Java and Kotlin programs that Elide runs get no OpenTelemetry API, agent, or trace context from Elide. Add the OpenTelemetry Java SDK or agent to the program as on any JVM. `elide build` and `elide test` still export their own spans; see [OpenTelemetry](https://elide.help/docs/opentelemetry#languages). ## Rewrite and inspect code For projects with `elide.pkl`, [OpenRewrite](https://elide.help/docs/toolchain/jvm/rewrite) previews and applies Java recipes, and the [dependency code index](https://elide.help/docs/toolchain/jvm/code-index) finds class origins, inspects members, and queries compiled Java and Kotlin references. Both are experimental in 1.6.0. ## Samples - [Java records and streams](https://elide.help/docs/code-samples#java-records-and-streams) - [Kotlin collections](https://elide.help/docs/code-samples#kotlin-collections) - [Kotlin tests](https://elide.help/docs/code-samples#kotlin-tests) - [Kotlin coroutines](https://elide.help/docs/code-samples#kotlin-coroutines) - [Java with a Maven dependency](https://elide.help/docs/code-samples#java-with-a-maven-dependency) Start from a template: ```bash elide init --template java # Java app with a JUnit test elide init --template ktjvm # Kotlin app with a test elide init --template workspace # Kotlin library and app in one workspace ``` --- # WebAssembly with Elide URL: https://elide.help/docs/wasm > Run WASI command modules with Elide, map host directories, load WebAssembly libraries from JavaScript and TypeScript, and check supported proposals. WebAssembly support is experimental in 1.6.0. | You have | Use | Result | | --- | --- | --- | | A WASI command | `elide run app.wasm` | Runs the module with WASI Preview 1 imports. | | A WASM library | The `WebAssembly` API or an ES module import from JS/TS | Exposes the module's exports. | elide app.wasm — WASI commands and WASM libraries from JavaScript To compile Java or Kotlin to WebAssembly, see [WebImage](https://elide.help/docs/toolchain/jvm/webimage); its output needs its JavaScript loader, not `elide run`. Target guides: [Browser WASM](https://elide.help/docs/toolchain/web/wasm) and [Edge WASM](https://elide.help/docs/toolchain/edge/wasm). ## Run a WASM file ```bash elide run app.wasm elide app.wasm elide run app.wasm -- first second # program arguments elide run --timeout=5s app.wasm # exit 124 after 5 seconds ``` Elide calls the exported `_start`, or `_main` if `_start` is absent. Load a module with neither from JavaScript. | Behavior | Value | | --- | --- | | Argument zero | The module's absolute path. | | Exit status | Set by WASI `proc_exit`, not by a function's return value. | | Traps, malformed binaries | Nonzero exit. | | `--timeout` | Covers instantiation and execution; exits `124`. | ### Project entrypoints Set the module as the entrypoint in `elide.pkl`, then run `elide run`: ```pkl amends "elide:project.pkl" name = "wasm-app" entrypoint { "app.wasm" } ``` See [Project setup](https://elide.help/docs/projects). ## WASI Commands get WASI Preview 1 imports under `wasi_snapshot_preview1`: standard streams, arguments, exit status, and filesystem operations. Libraries loaded from JavaScript do not get WASI. ### Directory access WASI commands see no host directories until you map one: ```bash elide -Xpolyglot.wasm.WasiMapDirs=work::./data run app.wasm ``` This maps `./data` to the guest directory `work`. Separate mappings with commas: `work::./data,output::./results`. The sandbox still applies. WASI file opens need read and write permission, even for reads: ```bash elide -Xpolyglot.wasm.WasiMapDirs=work::./data run \ --sandbox --allow-read=./data --allow-write=./data app.wasm ``` See [Sandbox and Limits](https://elide.help/docs/sandbox). ## JavaScript and TypeScript interop The global `WebAssembly` API needs no flag: ```javascript import { readFile } from "node:fs/promises"; const bytes = await readFile(new URL("./math.wasm", import.meta.url)); const { instance } = await WebAssembly.instantiate(bytes, {}); console.log(instance.exports.add(20, 22)); ``` Modules loaded from JavaScript do not run `_start` or `_main`. The second argument supplies the module's imports: ```javascript const imports = { env: { log: (value) => console.log(value) } }; const { instance } = await WebAssembly.instantiate(bytes, imports); ``` The API includes `validate`, `compile`, `Module`, `Instance`, `Memory`, `Table`, `Global`, and import and export inspection. A compiled `Module` can be instantiated more than once. File reads follow the usual permissions. ### ES module imports ```javascript import { add } from "./math.wasm"; console.log(add(20, 22)); ``` ```javascript const math = await import("./math.wasm"); console.log(math.add(20, 22)); ``` Specifiers can be paths, `file:` URLs, or package exports that resolve to `.wasm`. A source-phase import returns the compiled module to instantiate yourself: ```javascript import source mathModule from "./math.wasm"; const math = await WebAssembly.instantiate(mathModule, {}); console.log(math.exports.add(20, 22)); ``` ## Supported WebAssembly proposals On by default, for commands and JS/TS interop: - Mutable globals and sign-extension operators - Non-trapping float-to-integer conversions - Multi-value function and block results - Bulk memory operations and reference types - Multiple memories - Extended constant expressions - Exception handling - Typed function references - Garbage-collected types (WasmGC) - Tail calls - Fixed-width SIMD (`v128`) and relaxed SIMD, except with Python installed Off by default: | Proposal | Option | Notes | | --- | --- | --- | | Memory64 | `wasm.Memory64` | Also requires `wasm.UseUnsafeMemory`. | | Threads and atomics | `wasm.Threads` | No WASI thread-spawning host API is supplied. | | Wide integer arithmetic | `wasm.WideArithmetic` | Separate from ordinary `i64` arithmetic. | | Legacy exception handling | `wasm.LegacyExceptions` | The newer exception-handling proposal is on by default. | Enable one with `-Xpolyglot.