nustack
ReferenceNulang

helpers.run

All-in-one entries: compile, validate, drive in one call.

Module nu.lang.helpers.run.

All-in-one entries: compile, validate, drive in one call.

Take a Term, compile it against the Nu schema, validate against the Nu law set, then drive. Three phases in one call, what app code usually wants. The standalone pieces stay available via nu.lang for callers that want a Program in hand (e.g. for static inspection).

NameCallMeaning
arunlang.arun(term, ctx=None, max_parallel=1)Async sibling of run: compile, validate, then aeval.
runlang.run(term, ctx=None, max_parallel=1)Compile a Term, validate it, evaluate it; return (value, ctx).
run_in_looplang.run_in_loop(term, ctx=None, max_parallel=1)Compile, validate, then drive on a fresh loop from sync code.

arun

Async sibling of run: compile, validate, then aeval.

lang.arun(term, ctx=None, max_parallel=1)

Path nu.lang.arun. Defined on nu.lang.helpers.run, bound as a function. Builds tuple[V, Context].

Arguments

NameTypeDefaultMeaning
termNu[V]
ctxContext | NoneNone
max_parallelint1

Undocumented: example.

run

Compile a Term, validate it, evaluate it; return (value, ctx).

lang.run(term, ctx=None, max_parallel=1)

Path nu.lang.run. Defined on nu.lang.helpers.run, bound as a function. Builds tuple[V, Context].

Arguments

NameTypeDefaultMeaning
termNu[V]a Nu Term (the description).
ctxContext | NoneNonethe Context to drive against; a fresh one if omitted.
max_parallelint1tree-wide concurrency gate. 1 is sequential.

Undocumented: example.

run_in_loop

Compile, validate, then drive on a fresh loop from sync code.

lang.run_in_loop(term, ctx=None, max_parallel=1)

Path nu.lang.run_in_loop. Defined on nu.lang.helpers.run, bound as a function. Builds tuple[V, Context].

For the rare top-level sync caller whose Term compiles to an async-only Program: spins a loop via asyncio.run and drives the async path so the caller doesn't have to write an async def. Most callers should use arun directly.

Arguments

NameTypeDefaultMeaning
termNu[V]
ctxContext | NoneNone
max_parallelint1

Undocumented: example.

On this page