nu is a Python programming model for apps that span many systems. Every resource is a Ref, wherever it lives: a database row, a UI widget, an LLM endpoint, a remote worker. Interactions with Refs are first-class primitives you compose into programs.
Most app code is not about values, it is about moving them between systems: a database, a browser, a worker, an LLM. nu makes that interaction the primitive.
- Ref: a name for a value, wherever it lives. A KV slot, a text block in the browser, an LLM endpoint.
- Interaction: what you do with a Ref. Read, write, branch, iterate, compose.
- Fabric: binds Refs to a real system. Bind as many as you need, they all speak the same primitive.
Setting a text block in the browser is the same interaction as setting a KV slot.
A counter that survives restarts:
import nu
import nustd
class DB(nu.Shape):
hits = nustd.kv.IntRef.slot()
op = DB.hits.init(0) >> DB.hits.inc() >> nu.print(nu.str(DB.hits))
app = nu.With(
nustd.kv.rocksdb_navigator(".db"),
body=nustd.kv.auto_flow_atomic(op),
)
nu.run(app) # 1, then 2 on the next run, then 3A live browser UI, same shape. Set the text block like a variable and the page updates:
import asyncio
import nu
import nustd
class Home(nustd.ui.Column):
hello = nustd.ui.TextRef.slot()
op = Home.hello.set("Hello, browser.")
asyncio.run(nu.arun(nustd.ui.serve(op)))The same goes for workers, a Ray cluster or an LLM: bind another fabric, keep the code. More in examples/, eg python examples/movies.py for a form, a filterable table and detail pages.
Python 3.10 or newer.
pip install "nustd[all]"nucore is the kernel: the model, the engine and in-memory state. nustd adds the fabrics and pulls in nucore. Pick extras to install only what you need, eg nustd[kv,ui].
| Module | What it binds | Extra |
|---|---|---|
nustd.kv |
Persistent state over RocksDB, LMDB or SQLite, with transactions and change notifications | kv |
nustd.blob |
Write-once bytes, stored and streamed by range. On LMDB, plain files or S3 | blob |
nustd.ui |
Widgets as Refs, rendered in the browser and kept live | ui |
nustd.mp, nustd.cluster |
Local worker processes or a Ray cluster: run any tree on any worker | mp, cluster |
nustd.proxy |
Any fabric, used from another process | proxy |
nustd.acp |
Coding agents (Claude Code, Codex, Gemini) over the Agent Client Protocol | acp |
nustd.llm |
OpenAI-compatible chat: OpenAI, Ollama, vLLM, OpenRouter, Groq, xAI, Cerebras | llm |
Plus Python's standard library in the same shape: math, random, time, datetime, itertools, functools, json, pathlib, uuid, decimal and more. Same names and call signatures, but a call returns a tree that composes into the rest of the program. Every module in the nustd README.
nu is the Python implementation of the interaction model. nuspace is what we build with it: a computational space where everything, the space included, is a nu program.
- Discord: ask questions, share what you build with nu
- X @nustackdev: releases and work in progress
- Issues: bugs and feature requests
Building on nu? Add the badge:
[](https://github.com/nustackdev/nu)Apache-2.0. See LICENSE.md.