fabric ·nu.mem

Hot state, zero backend.

The simplest state in Nu. Declare a Shape, hang typed Refs, use them. Gone when the process ends.

See it.

Declare a Shape, hang typed Refs, use them. That is the whole surface.

The simplest state in Nu.

Same IntRef, DictRef, ShapeRef you use everywhere else in Nu. Reads and writes are in-process, no serialization, no round trip. Use it for cache, hot state, and coordination between Shapes in one process.

No backend to pick. No transactions to wrap. Restart clears it. That is the whole point.

memory.py
python · 25 locpy
import nu
class Session(nu.Shape):
user: nu.mem.StrRef
hits: nu.mem.IntRef
tags: nu.mem.PrimitiveListRef[str]
class Cache(nu.Shape):
sessions: nu.mem.ShapesDictRef[str, Session]
active: nu.mem.IntRef
# refs read and write like plain attributes
who = Cache.sessions["ada"].user
score = Cache.sessions["ada"].hits + 1
# compose writes as one flow
bump = (
Cache.sessions["ada"].hits.inc()
| Cache.sessions["ada"].tags.append("seen")
| Cache.active.inc()
)
# assemble and run
ctx = nu.Context().bind(dict, {}, Cache)
nu.run(bump, ctx=ctx)

Try Nu.

One command gets you the wheel with every fabric. Then follow the movies tutorial to build a real app in an afternoon.

01 Install

pip install "nustack-py[all]"

02 Run the demo

nu demo movies

03 Build your app

Browse examples

Like what you see?

The project is young. Star it, join the room, watch what we ship next.