Installation
One package, linnet-lang, holds the linnet compiler, its standard library and the Python package linnet. Install it with uv:
uv add "linnet-lang[torch]"
uv run linnet --versionPick the extras for the frameworks you use:
| Extra | Adds |
|---|---|
torch | linnet.torch: load, train and export in PyTorch, and linnet.serve |
jax | linnet.jax: load, train and export in JAX |
flax | linnet.jax.load_nnx |
onnx | linnet.onnx; add onnxruntime, or onnxruntime-gpu for CUDA and TensorRT, to run models |
nest | linnet.nest: models from Nest and the Hugging Face Hub |
serve | linnet serve: PyTorch, the Hub and a tokenizer, to serve a model with OpenAI's API |
all | all of them |
Outside a uv project, uv pip install "linnet-lang[torch]" installs into the active environment, and uv run --with "linnet-lang[torch]" python script.py runs one script. pip install works the same way.
The wheels for Linux (x86_64, aarch64), macOS (arm64, 14 or newer) and Windows (x64) carry the compiler. On another platform, build the compiler from source and point LINNET_BIN at it.
From source
You need CMake 3.25 or newer, Ninja, and a C++23 compiler (GCC 13, Clang 19 or MSVC 2022).
git clone https://github.com/franknoh/Linnet.git
cd Linnet
cmake --preset release
cmake --build --preset release
ctest --preset release # optionalThe executable is build/release/linnet and finds stdlib/ in the checkout. Elsewhere, pass --std <dir> or set LINNET_STD. To use it from the Python package, set LINNET_BIN=build/release/linnet. In python/linnet, uv sync --all-extras installs the package with every backend and test dependency.
Editors
The editors run the language server, linnet lsp.
VS Code
Install Linnet from the Visual Studio Marketplace, or from Open VSX in VSCodium and Cursor. The builds for Linux, macOS (Apple silicon) and Windows carry the compiler and need nothing else. The releases page has the same .vsix files for code --install-extension.
linnet.path picks another compiler (in a uv project, .venv/bin/linnet), and linnet.stdRoot passes --std. Run Linnet: Restart Language Server after changing the compiler. From a checkout:
cd editors/vscode && npm install && npm run check
npx @vscode/vsce package
code --install-extension linnet-*.vsixNeovim and Vim
mkdir -p ~/.local/share/nvim/site/pack/linnet/start
ln -s "$PWD/editors/vim" ~/.local/share/nvim/site/pack/linnet/start/linnetvim.api.nvim_create_autocmd("FileType", {
pattern = "linnet",
callback = function(args)
vim.lsp.start({
name = "linnet",
cmd = { "linnet", "lsp", "--stdio" },
root_dir = vim.fs.root(args.buf, { "linnet.toml", ".git" }),
})
end,
})gq formats through linnet fmt -.
Other editors
Run linnet lsp --stdio from any Language Server Protocol client. For highlighting, use the TextMate grammar editors/textmate/linnet.tmLanguage.json.
Next: the Quickstart, or Coming from PyTorch if you already have models.