Skip to content

API Index ​

This page lists every public builtin constant, function, method, module type, and builtin enum that the manual documents. Each entry gives the exact signature and a one-line summary. The linked manual pages have the examples and full rules.

assert condition and assert condition, message are statements, not callable APIs. Assertions covers their typing, lazy message evaluation, AU4001, cleanup, and matching behavior across backends.

Top-Level Builtins ​

APISignatureBehavior
printprint(value) -> NoneRenders value and writes it with a newline.
rangerange(stop: int64) -> Range; range(start: int64, stop: int64) -> RangeInteger range that excludes the end value.
cancelledcancelled() -> boolReturns whether the current task is cancelled.
yield_nowyield_now() -> NoneYields the current lightweight task to the scheduler.
sleepsleep(duration: Duration) -> NoneSuspends the current task through the scheduler.
selectselect(source, ...) -> SelectOutcome[Q, T]Waits on one or more positional sources. Each source is a Queue, a Task, or a relative Duration. Cancellation wins. Otherwise the ready source with the lowest index wins.
wait_anywait_any(tasks: list[Task[T]], timeout: Duration = ...) -> WaitAny[T]Waits for the first task outcome. When T is non-repeatable, it consumes the list and abandons the rights of the tasks it does not choose. wait_any([]) returns TimedOut immediately.
wait_allwait_all(tasks: list[Task[T]], timeout: Duration = ...) -> WaitAll[T]Waits for all tasks, the first task error, the timeout, or cancellation. When T is non-repeatable, it consumes the list.
absabs(value: number) -> numberAbsolute value of an integer or a float.
minmin(left: number, right: number) -> numberThe smaller of two values of the same numeric type.
maxmax(left: number, right: number) -> numberThe larger of two values of the same numeric type.
sqrt`sqrt(value: float32float64) -> float32
roundround(value: T) -> T for integers; round(value: float32|float64) -> int64Returns an integer unchanged. Rounds a float to the nearest integer, with ties to even.
divmoddivmod(left: T, right: T) -> (T, T) for one exact integer or float typeReturns the floor quotient and the remainder. The remainder takes the sign of the divisor.
parse_int32parse_int32(text: str) -> Result[int32, str]Parses a signed 32-bit integer.
parse_int64parse_int64(text: str) -> Result[int64, str]Parses a signed 64-bit integer.
parse_float64parse_float64(text: str) -> Result[float64, str]Parses a 64-bit float.
lenlen(value: str|list[T]|dict[K, V]|set[T]|Array[T]) -> int64Returns the same int64 as the value's own len() method.
strstr(value) -> strRenders value exactly as print and f-string interpolation do.

Foreign Declarations ​

Foreign function interface declarations, or FFI declarations, are direct calls that a package authorizes. They are not builtins and not first-class function values. The binding package supplies their names and exact signatures.

SurfaceSignatureBehavior
C functionextern "C" def name(...) -> RSynchronous call with no body to the process-global symbol of the same name.
Opaque handleextern "C" opaque class HandleWraps a non-null foreign pointer. The handle is not Copy, not cloneable, and not Transfer.
str viewtext: strPasses a temporary const UTF-8 pointer and a byte length. An empty string is (NULL, 0). No NUL terminator is promised.
Byte viewbytes: list[uint8]Passes a temporary const pointer and a byte length. An empty list is (NULL, 0).
Mutable byte viewbytes: mut list[uint8]Copies into a same-length scratch buffer and back out. The writeback happens after the native call returns and before the result is validated.
Consuming handlehandle: own HandleMoves the opaque handle into a foreign call that closes or frees it.

FFI v0 has the full scalar table, the manifest report, the safety boundary, diagnostics, and backend rules.

Scalars And str ​

APISignatureBehavior
float64.sqrtsqrt() -> float64Square root of the receiver.
integer .to_floatto_float() -> float64Converts any integer type with IEEE-754 round-to-nearest, ties-to-even. The result may round.
integer wrapping methodswrapping_add(rhs), wrapping_sub(rhs), wrapping_mul(rhs)Two's-complement arithmetic that wraps at the type's fixed width. Operands and result share one type.
integer saturating methodssaturating_add(rhs), saturating_sub(rhs), saturating_mul(rhs)Arithmetic that clamps to the declared width. Operands and result share one type.
integer wrapping shiftswrapping_shl(count), wrapping_shr(count)count has the receiver's type. Left shift discards high bits. Right shift matches >> once the count is validated.
integer saturating shiftssaturating_shl(count), saturating_shr(count)count has the receiver's type. Left shift clamps. Right shift matches >> once the count is validated.
scalar .to_stringto_string() -> strAvailable on bool, the integer types, float32, and float64.
Duration.msDuration.ms(value: int64) -> DurationBuilds an exact signed Duration from milliseconds.
Duration.secondsDuration.seconds(value: int64) -> DurationBuilds an exact signed Duration from seconds.
Duration.minutesDuration.minutes(value: int64) -> DurationBuilds an exact signed Duration from minutes.
Duration.to_msto_ms() -> float64Converts the exact nanosecond count to the nearest binary64 milliseconds, ties-to-even. The result may round.
Duration.to_secondsto_seconds() -> float64Converts the exact nanosecond count to the nearest binary64 seconds, ties-to-even. The result may round.
str.lenlen() -> int64Counts Unicode scalar values in O(n) time.
str.byte_lenbyte_len() -> int64Returns the UTF-8 byte count in O(1) time.
str.to_bytesto_bytes() -> list[uint8]Returns a fresh list of the receiver's exact UTF-8 bytes.
str.from_bytesfrom_bytes(bytes: list[uint8]) -> Result[str, bytes.Error]Validates UTF-8 strictly. Returns a fresh str, or an error with the offset of the first invalid byte.
str.containscontains(text: str) -> booltrue when the receiver contains text.
str.starts_withstarts_with(text: str) -> boolTests for a prefix.
str.ends_withends_with(text: str) -> boolTests for a suffix.
str.splitsplit(text: str) -> list[str]Splits at each occurrence of text.
str.replacereplace(from: str, to: str) -> strReturns a new string with the replacements applied.
str.to_lowerto_lower() -> strConverts to Unicode lowercase.
str.to_upperto_upper() -> strConverts to Unicode uppercase.
str.strip_prefixstrip_prefix(text: str) -> str | NoneReturns the rest of the string when the prefix matches, or None when it does not. An empty rest is a present "".
str.strip_suffixstrip_suffix(text: str) -> str | NoneReturns the rest of the string when the suffix matches, or None when it does not. An empty rest is a present "".
str.trimtrim() -> strRemoves leading and trailing Unicode whitespace.
str.trim_starttrim_start() -> strRemoves leading Unicode whitespace.
str.trim_endtrim_end() -> strRemoves trailing Unicode whitespace.
str.split_oncesplit_once(separator: str) -> (str, str) | NoneSplits at the first occurrence of separator. Returns None when it is absent. An empty separator traps with AU4003.
str.rsplit_oncersplit_once(separator: str) -> (str, str) | NoneSplits at the last occurrence of separator. Returns None when it is absent. An empty separator traps with AU4003.
str.lineslines() -> list[str]Splits at each \n and removes one \r before each \n. A final line terminator adds no empty line. An empty string has no lines.
str.split_whitespacesplit_whitespace() -> list[str]Splits on runs of Unicode whitespace and drops empty parts.
str.findfind(text: str) -> int64 | NoneIndex of the first occurrence of text, counted in Unicode scalar values. O(n). Returns None when it is absent. An empty text returns 0.
str.countcount(text: str) -> int64Number of non-overlapping occurrences of text. An empty text traps with AU4003.
str.repeatrepeat(count: int64) -> strConcatenates count copies. A negative count traps with AU4003. A result above the 64 MiB string limit traps with AU4005 before it allocates.
str.joinjoin(parts: list[str]) -> strJoins parts with the receiver as the separator.
str.cloneclone() -> strReturns a new owned string.

These Duration operators each return a Duration:

  • Duration + Duration
  • Duration - Duration
  • Duration * int64
  • int64 * Duration
  • Duration // int64

Duration values also support equality and all four ordering comparisons. Arithmetic is checked on signed i128 nanoseconds.

Numeric Arrays ​

In this section, T and U are each exactly one of int32, int64, float32, or float64. Numeric Arrays covers shape, ownership, diagnostics, and backend behavior.

APISignatureBehavior
Array[T].zeroszeros(shape: list[int64]) -> Array[T]Fresh zero-filled buffer in row-major order, with rank at least one.
Array[T].fullfull(shape: list[int64], value: T) -> Array[T]Fresh buffer filled with value.
Array[T].from_listfrom_list(values: list[T], shape: list[int64]) -> Array[T]Copies the shared list into the exact row-major shape.
Array.shapeshape() -> list[int64]Returns an owned snapshot of the shape.
Array.lenlen() -> int64Total number of elements.
Array.cloneclone() -> Array[T]Makes an explicit fresh copy of the whole buffer.
Array.getget(index: list[int64]) -> T | NoneReads one coordinate. Returns None when the coordinate is out of bounds or the rank does not match.
Array.setset(index: list[int64], value: T) -> T | NoneReplaces one element in place and returns the old scalar. An invalid coordinate or rank traps instead of returning None.
Array.fillfill(value: T) -> NoneFills every element in place, in row-major order.
Array.mapmap[U](f: def(T) -> U) -> Array[U]Applies a repeatable callback eagerly, in row-major order.
Array.sumsum() -> TDeterministic reduction in the element type. An empty Array returns zero.
Array.minmin() -> TSmallest element. An empty Array is AU4007.
Array.maxmax() -> TLargest element. An empty Array is AU4007.
Array.meanmean() -> float64Accumulates in and returns float64. An empty Array is AU4007.
integer Array wrapping methodswrapping_add(rhs), wrapping_sub(rhs), wrapping_mul(rhs)rhs is an Array of the same shape or a scalar of the same element type. Returns a fresh Array.
integer Array saturating methodssaturating_add(rhs), saturating_sub(rhs), saturating_mul(rhs)rhs is an Array of the same shape or a scalar of the same element type. Returns a fresh Array.

Math ​

Every argument is exactly float64. The module performs no implicit numeric conversion. Math Module has the full IEEE-754, domain, evaluation-order, diagnostic, and backend rules.

APISignatureBehavior
math.pifloat64 constantNearest binary64 value to pi, bits 0x400921fb54442d18.
math.efloat64 constantNearest binary64 value to Euler's number, bits 0x4005bf0a8b145769.
math.inffloat64 constantPositive infinity, bits 0x7ff0000000000000.
math.nanfloat64 constantCanonical quiet NaN, bits 0x7ff8000000000000.
math.floorfloor(value: float64) -> int64Greatest integer less than or equal to value. Checked against the int64 range.
math.ceilceil(value: float64) -> int64Least integer greater than or equal to value. Checked against the int64 range.
math.trunctrunc(value: float64) -> int64Truncates toward zero. Checked against the int64 range.
math.powpow(base: float64, exponent: float64) -> float64Binary64 exponentiation. The Math Module page specifies its identity, domain, and overflow cases.
math.expexp(value: float64) -> float64Base-e exponential.
math.loglog(value: float64) -> float64Natural logarithm.
math.log2log2(value: float64) -> float64Base-2 logarithm.
math.log10log10(value: float64) -> float64Base-10 logarithm.
math.sinsin(value: float64) -> float64Sine in radians.
math.coscos(value: float64) -> float64Cosine in radians.
math.tantan(value: float64) -> float64Tangent in radians.

Randomness ​

Randomness Module specifies the xoshiro256** algorithm, the seed-42 vectors, ownership, the secure-source boundary, and diagnostics.

APISignatureBehavior
random.RngRng(seed: int64) -> random.RngCreates a move-only deterministic stream. The seed's exact two's-complement bit pattern selects the stream.
random.Rng.next_intnext_int(lo: int64, hi: int64) -> int64Uniform integer in the half-open range [lo, hi). Needs a mutable receiver.
random.Rng.next_floatnext_float() -> float64Uniform 53-bit binary64 value in [0.0, 1.0). Needs a mutable receiver.
random.Rng.shuffleshuffle[T](values: mut list[T]) -> NoneShuffles in place with descending Fisher-Yates. Needs a mutable receiver and a mutable list.
random.secure_intsecure_int(lo: int64, hi: int64) -> int64Uniform half-open integer from the operating system's secure source. Has no deterministic fallback.
random.secure_bytessecure_bytes(n: int64) -> list[uint8]Returns exactly n secure bytes from the operating system for 0 <= n <= 2147483647. Zero skips the entropy read. A larger count traps with AU4005 before allocating.

random.Rng has no public clone route. AU3007 rejects the clone-producing collection and task APIs on this page when the value they produce contains, or may contain, an Rng. That includes an Rng inside a user-defined wrapper.

Cloning an allowed Task or Queue handle copies only the handle. AU3008 rejects random.Rng as a task result or a Queue payload. A Task with a non-repeatable result is not copyable.

Moves, collection removals, and in-place shuffles within one owning task move or reorder values. None of them duplicates generator state.

Generic clone-producing calls infer clone-safety obligations and check them after specialization. The obligation carries through generic callers and module imports.

Bytes, Text Codecs, And SHA-256 ​

Bytes, Text Codecs, And SHA-256 covers exact UTF-8 preservation, the strict policy for malformed input, error offsets, ownership, up-front output size checks, and the cryptographic scope of SHA-256.

APISignatureBehavior
str.to_bytesto_bytes() -> list[uint8]Exact UTF-8 bytes. Reads a shared receiver and returns a fresh list.
str.from_bytesfrom_bytes(bytes: list[uint8]) -> Result[str, bytes.Error]Strict UTF-8 with no replacement decoding.
bytes.hex_encodehex_encode(value: list[uint8]) -> strTwo lowercase ASCII digits per byte.
bytes.hex_decodehex_decode(text: str) -> Result[list[uint8], bytes.Error]Accepts ASCII hex in mixed case. Rejects prefixes, separators, and whitespace.
bytes.base64_encodebase64_encode(value: list[uint8]) -> strRFC 4648 standard alphabet with canonical padding.
bytes.base64_decodebase64_decode(text: str) -> Result[list[uint8], bytes.Error]Strict decode of canonical standard-alphabet input.
bytes.sha256sha256(value: list[uint8]) -> list[uint8]Fresh raw 32-byte FIPS 180-4 digest.
bytes.sha256_stringsha256_string(text: str) -> list[uint8]SHA-256 of the text's exact UTF-8 bytes.
bytes.starts_withstarts_with(value: list[uint8], prefix: list[uint8]) -> boolTests for a byte prefix. An empty prefix matches.
bytes.ends_withends_with(value: list[uint8], suffix: list[uint8]) -> boolTests for a byte suffix. An empty suffix matches.
bytes.findfind(value: list[uint8], needle: list[uint8]) -> int64 | NoneByte index of the first occurrence of needle. Returns None when it is absent. An empty needle returns 0.

Every input above uses shared access and stays usable after the call. An encoding argument is reserved but not implemented. Expanded output that cannot be represented or allocated traps with AU4005. Malformed data returns bytes.Error.

Collections ​

Collections covers ownership and iteration.

list[T] ​

APISignatureBehavior
list[T]()list[T]()Creates an empty list.
list.lenlen() -> int64Number of elements.
list.is_emptyis_empty() -> booltrue when the list is empty.
list.copycopy() -> list[T]Returns independent owned storage. Requires clone-safe T.
list.appendappend(value: own T) -> NoneMoves value onto the end.
list.poppop(index: int64 = -1) -> TRemoves the element at the normalized position and moves it out. An invalid position traps.
list.getget(index: int64) -> Lookup[T]Normalizes a negative index, then returns Lookup.Found(value) with a clone of the element. Returns Lookup.Missing when the index is out of bounds. Requires clone-safe T.
list.lookupmatch [mut] items.lookup(index):Normalizes a negative index once. Runs case Lookup.Found(item): with a view of the element, or the Missing arm when the index is out of bounds. Only valid as a match subject. Has no clone requirement.
list.setset(index: int64, value: own T) -> TReplaces the element and moves the old one out. An invalid position traps.
list.removeremove(value: T) -> NoneRemoves the first equal value. A missing value traps with AU4008.
list.indexindex(value: T) -> int64Returns the position of the first equal value. A missing value traps with AU4008.
list.countcount(value: T) -> int64Number of equal elements.
list.swapswap(first: int64, second: int64) -> NoneNormalizes two positions and swaps them. An invalid position traps.
list.extendextend(other: own list[T]) -> NoneMoves the elements of other into the receiver.
list.insertinsert(index: int64, value: own T) -> NoneInserts before the position, clamped the way Python clamps it.
list.clearclear() -> NoneRemoves all elements.
list.reversereverse() -> NoneReverses the list in place.
list.sortsort(reverse: bool = false) -> NoneStable in-place sort by natural order. Requires T: Ord.
list.sortsort[K](key: def(T) -> K, reverse: bool = false) -> NoneStable sort by key. Computes each key once before changing the list. Requires K: Ord.
list.mapmap[U](f: def(T) -> U) -> list[U]Traverses the list eagerly through shared access into a fresh owned result. The source stays usable.
list.filterfilter(f: def(T) -> bool) -> list[T]Traverses the list eagerly through shared access into a fresh owned result. The source stays usable. Requires clone-safe T.
list.reservereserve(additional: int64) -> NoneMakes room for at least len() + additional elements.
list[T].with_capacitywith_capacity(minimum: int64) -> list[T]Creates an empty list with at least the requested capacity.

Span[T] ​

APISignatureBehavior
Span.lenlen() -> int64Length of the range.
Span.indexindex(value: T) -> int64Position of the first equal element in the range. Traps with AU4008 when none is equal.
Span.countcount(value: T) -> int64Number of equal elements in the range.
Span.reversereverse() -> NoneReverses the range in place. Needs a mutable span.
Span.sortsort(reverse: bool = false) -> NoneStably sorts the range in place. Needs a mutable span.
Span.swapswap(first: int64, second: int64) -> NoneSwaps two positions of the range. Needs a mutable span.
Span.fillfill(value: T) -> NoneWrites value to every position. Needs a mutable span and a Copy T.
Span.to_listto_list() -> list[T]Owned copy of the range. Requires clone-safe T.

dict[K, V] ​

APISignatureBehavior
dict[K, V]()dict[K, V]()Creates an empty dictionary.
dict.lenlen() -> int64Number of entries.
dict.is_emptyis_empty() -> booltrue when the dictionary is empty.
dict.copycopy() -> dict[K, V]Returns independent owned storage. Requires clone-safe K and V.
dict.getget(key: K) -> Lookup[V]Returns Lookup.Found(value) with a clone of the value, or Lookup.Missing when the key is absent. A stored None value is Found(None). Requires clone-safe V.
dict.lookupmatch [mut] table.lookup(key):Runs case Lookup.Found(value): with a view of the value, or the Missing arm when the key is absent. Only valid as a match subject. Has no clone requirement.
dict.removeremove(key: K) -> Lookup[V]Removes the entry and moves its value into Lookup.Found(value), or returns Lookup.Missing. Has no clone requirement.
dict.keyskeys() -> list[K]Clones of the keys, in insertion order. Requires clone-safe K.
dict.valuesvalues() -> list[V]Clones of the values, in insertion order. Requires clone-safe V.
dict.itemsitems() -> list[(K, V)]Cloned key/value tuples, in insertion order. Requires clone-safe K and V.
dict.clearclear() -> NoneRemoves all entries.
dict.updateupdate(other: own dict[K, V]) -> NoneMoves the entries of other into the receiver. A key that already exists keeps its position.
dict.reservereserve(additional: int64) -> NoneMakes room for at least len() + additional entries.
dict[K, V].with_capacitywith_capacity(minimum: int64) -> dict[K, V]Creates an empty dictionary with at least the requested capacity.

set[T] ​

APISignatureBehavior
set[T]()set[T]()Creates an empty set.
set.lenlen() -> int64Number of unique values.
set.is_emptyis_empty() -> booltrue when the set is empty.
set.copycopy() -> set[T]Returns independent owned storage. Requires clone-safe T.
set.addadd(value: own T) -> NoneMoves value into the set.
set.removeremove(value: T) -> NoneRemoves an equal value. A missing value traps with AU4008.
set.discarddiscard(value: T) -> NoneRemoves an equal value if one is present.
set.clearclear() -> NoneRemoves all values.
set.reservereserve(additional: int64) -> NoneMakes room for at least len() + additional values.
set[T].with_capacitywith_capacity(minimum: int64) -> set[T]Creates an empty set with at least the requested capacity.

Concurrency ​

Concurrency covers structured concurrency.

APISignatureBehavior
Queue[T]()Queue[T](capacity: int32 = ...)Creates a queue. Supplying capacity makes it bounded. Requires T: Transfer.
Queue.putput(value: own T, timeout: Duration = ...) -> Result[None, SendError[T]]Sends a value. On failure, the error holds the unsent value. Requires T: Transfer.
Queue.try_puttry_put(value: own T) -> Result[None, SendError[T]]Sends without waiting. Requires T: Transfer.
Queue.getget(timeout: Duration = ...) -> QueueReceive[T]Receives an item, or reports close, timeout, or cancellation. Does not check the payload for Transfer again.
Queue.pollpoll(timeout: Duration = ...) -> Poll[T]Returns Poll.Ready(value), or Poll.Unavailable on close, timeout, cancellation, or no item right away.
Queue.get_orget_or(default: own T, timeout: Duration = ...) -> TReturns a received value or the fallback.
Queue.closeclose() -> NoneCloses the queue and wakes any waiters.
Task.resultresult(timeout: Duration = ...) -> TaskResult[T]Waits for the task outcome. When T is non-repeatable, it consumes the observation right.
Task.pollpoll(timeout: Duration = ...) -> Poll[T]Returns Poll.Ready(value), or Poll.Unavailable on failure, timeout, cancellation, or no result right away. When T is non-repeatable, it consumes the observation right, even on Unavailable.
Task.result_orresult_or(default: own T, timeout: Duration = ...) -> TReturns the value or the fallback. When T is non-repeatable, it consumes the observation right.
TaskGroup()TaskGroup()Creates a task group resource.
TaskGroup.startstart(function, own ...) -> Task[T]Every capture and the result must be Transfer. The target may be inferred or explicit, as function[Types] or Type.associated_method[Types]. The child runs on the guarded 768 KiB default stack.
TaskGroup.start_soonstart_soon(function, own ...) -> NoneSame Transfer and target rules as start, without returning a handle.
TaskGroup.start_with_stackstart_with_stack(bytes: int64, function, own ...) -> Task[T]Same Transfer and target rules as start, with an explicit guarded stack request of 256 KiB..64 MiB.
TaskGroup.start_soon_with_stackstart_soon_with_stack(bytes: int64, function, own ...) -> NoneSame rules and stack range as start_with_stack, without keeping a handle.
TaskGroup.cancelcancel() -> NoneSignals cancellation to the group's children.

The two stack-size methods are provisional. Their 256 KiB minimum is for tasks whose shallow stack use you have measured. It is not the default.

I/O And Filesystem ​

I/O Module covers input and output on the standard streams. Filesystem Module covers files and directories.

APISignatureBehavior
io.writewrite(text: str) -> Result[None, io.Error]Writes text without a newline.
io.flushflush() -> Result[None, io.Error]Flushes standard output.
io.read_lineread_line() -> Result[str | None, io.Error]Reads one line as strict UTF-8, without the trailing LF or CRLF. Returns Ok(None) only at a clean end of file.
fs.existsexists(path: str) -> boolChecks whether the path exists.
fs.read_to_stringread_to_string(path: str) -> Result[str, io.Error]Reads UTF-8 text, capped at 256 MiB.
fs.read_bytesread_bytes(path: str) -> Result[list[uint8], io.Error]Reads bytes, capped at 256 MiB.
fs.write_stringwrite_string(path: str, text: str) -> Result[None, io.Error]Creates or replaces a text file.
fs.write_byteswrite_bytes(path: str, bytes: list[uint8]) -> Result[None, io.Error]Creates or replaces a byte file.
fs.append_stringappend_string(path: str, text: str) -> Result[None, io.Error]Appends text.
fs.append_bytesappend_bytes(path: str, bytes: list[uint8]) -> Result[None, io.Error]Appends bytes.
fs.create_dircreate_dir(path: str) -> Result[None, io.Error]Creates one directory.
fs.read_dirread_dir(path: str) -> Result[list[str], io.Error]Returns the sorted names of the immediate entries. Host paths are decoded lossily.
fs.remove_fileremove_file(path: str) -> Result[None, io.Error]Removes a file.
fs.renamerename(source: str, target: str) -> Result[None, io.Error]Renames or moves a path, replacing an existing target file.
fs.openopen(path: str) -> Result[fs.File, io.Error]Opens a file for reading.
fs.createcreate(path: str) -> Result[fs.File, io.Error]Creates or truncates a file for writing.
fs.appendappend(path: str) -> Result[fs.File, io.Error]Opens a file for appending and creates it if needed.
fs.File.read_allread_all() -> Result[str, io.Error]Reads the rest of the file as strict UTF-8 text, capped at 256 MiB.
fs.File.read_bytesread_bytes() -> Result[list[uint8], io.Error]Reads the remaining bytes, capped at 256 MiB.
fs.File.write_allwrite_all(text: str) -> Result[None, io.Error]Writes all of the text.
fs.File.write_byteswrite_bytes(bytes: list[uint8]) -> Result[None, io.Error]Writes all of the bytes.
fs.File.flushflush() -> Result[None, io.Error]Flushes pending writes.
fs.File.syncsync() -> Result[None, io.Error]Flushes pending writes and waits until they reach storage (fsync).
fs.File.closeclose() -> NoneCloses the handle.

Control-Plane Modules ​

Control-Plane Modules documents these modules.

APISignature
sys.argsargs() -> list[str]
sys.envenv(name: str) -> str | None
sys.current_dircurrent_dir() -> Result[str, io.Error]
sys.unix_time_msunix_time_ms() -> int64
sys.monotonic_time_msmonotonic_time_ms() -> int64
path.joinjoin(base: str, child: str) -> str
path.parentparent(path: str) -> str | None
path.file_namefile_name(path: str) -> str | None
path.extensionextension(path: str) -> str | None
path.is_absoluteis_absolute(path: str) -> bool
json.parseparse(text: str) -> Result[json.Value, json.Error]
json.dumpsdumps(value: json.Value, indent: int64 | None = None) -> str
json.is_nullis_null(value: json.Value) -> bool
json.as_boolas_bool(value: json.Value) -> bool | None
json.as_intas_int(value: json.Value) -> int64 | None
json.as_floatas_float(value: json.Value) -> float64 | None
json.into_stringinto_string(value: own json.Value) -> str | None
json.into_arrayinto_array(value: own json.Value) -> list[json.Value] | None
json.into_objectinto_object(value: own json.Value) -> dict[str, json.Value] | None
json.is_valid / toml.is_validis_valid(text: str) -> bool
json.stringify_map / toml.stringify_mapstringify_map(value: dict[str, str]) -> Result[str, str]
json.parse_string_map / toml.parse_string_mapparse_string_map(text: str) -> Result[dict[str, str], str]
log.debug/info/warn/error(message: str, fields: dict[str, str]) -> None
trace.event(name: str, fields: dict[str, str]) -> None
metrics.increment(name: str, value: int64) -> None
metrics.get(name: str) -> int64
metrics.reset() -> None
control.retryretry[T, E](worker: def() -> Result[T, E], max_attempts: int32 = 3, initial_backoff: Duration = 0ms) -> Result[T, E]

Metrics are process-global int64 counters. A missing name reads as zero. Overflow is a runtime diagnostic.

Dynamic JSON object dumps and bounded JSON and TOML string maps serialize keys in sorted order. The JSON Module page and the control-plane chapter give the exact rules for values, limits, host strings and paths, and telemetry records.

control.retry validates its arguments before it calls the worker. It needs at least one attempt and a backoff that is non-negative and representable on the host. It then:

  • runs the first attempt immediately
  • retries every Err, doubling the delay each time
  • skips sleeps of zero
  • returns the exact last Err
  • does no sleep or multiplication after the final attempt

Worker traps, backoff overflow, and cancellation of the current task propagate.

Network Constructors And HTTP Client Helpers ​

Network Module covers behavior and examples.

APISignature
net.connectconnect(address: str) -> Result[net.TcpStream, io.Error]
net.connect_timeoutconnect_timeout(address: str, timeout: Duration) -> Result[net.TcpStream, io.Error]
net.listenlisten(address: str) -> Result[net.TcpListener, io.Error]
net.udp_bindudp_bind(address: str) -> Result[net.UdpSocket, io.Error]
net.http_listenhttp_listen(address: str) -> Result[net.HttpListener, io.Error]
net.websocket_listenwebsocket_listen(address: str) -> Result[net.WebSocketListener, io.Error]
net.websocket_connectwebsocket_connect(url: str) -> Result[net.WebSocket, io.Error]
net.websocket_connect_timeoutwebsocket_connect_timeout(url: str, timeout: Duration) -> Result[net.WebSocket, io.Error]
net.unix_listenunix_listen(path: str) -> Result[net.UnixListener, io.Error]
net.unix_connectunix_connect(path: str) -> Result[net.UnixStream, io.Error]
net.unix_connect_timeoutunix_connect_timeout(path: str, timeout: Duration) -> Result[net.UnixStream, io.Error]
net.tls_listentls_listen(address: str, cert_pem_path: str, key_pem_path: str) -> Result[net.TlsListener, io.Error]
net.tls_connecttls_connect(address: str, server_name: str, ca_pem_path: str) -> Result[net.TlsStream, io.Error]
net.tls_connect_timeouttls_connect_timeout(address: str, server_name: str, ca_pem_path: str, timeout: Duration) -> Result[net.TlsStream, io.Error]
net.http_request_texthttp_request_text(method: str, url: str, body: str, headers: dict[str, str]) -> Result[net.HttpResponse, io.Error]
net.http_request_text_timeouthttp_request_text_timeout(method: str, url: str, body: str, headers: dict[str, str], timeout: Duration) -> Result[net.HttpResponse, io.Error]
net.http_request_byteshttp_request_bytes(method: str, url: str, bytes: list[uint8], headers: dict[str, str]) -> Result[net.HttpResponse, io.Error]
net.http_request_bytes_timeouthttp_request_bytes_timeout(method: str, url: str, bytes: list[uint8], headers: dict[str, str], timeout: Duration) -> Result[net.HttpResponse, io.Error]

Network Resource Methods ​

These limits apply to the methods below:

  • Bounded stream read counts are 1..=67108864.
  • UDP receive counts are 1..=65535.
  • Incoming HTTP parsing accepts at most 64 headers and 16 MiB of wire data per message.
  • WebSocket limits are 64 MiB per message and 16 MiB per frame/write buffer.

Network Module covers timeouts, EOF, UTF-8, cancellation, and repeated headers.

TypeAPISignature
net.TcpListeneracceptaccept(timeout: Duration = ...) -> Result[net.TcpStream, io.Error]
net.TcpListenerlocal_addrlocal_addr() -> Result[str, io.Error]
net.TcpListenercloseclose() -> None
net.TcpStreamread_allread_all(timeout: Duration = ...) -> Result[str, io.Error]
net.TcpStreamread_lineread_line(timeout: Duration = ...) -> Result[str | None, io.Error]
net.TcpStreamread_bytesread_bytes(max_bytes: int32, timeout: Duration = ...) -> Result[list[uint8] | None, io.Error]
net.TcpStreamread_exactread_exact(count: int32, timeout: Duration = ...) -> Result[list[uint8], io.Error]
net.TcpStreamwrite_allwrite_all(text: str, timeout: Duration = ...) -> Result[None, io.Error]
net.TcpStreamwrite_byteswrite_bytes(bytes: list[uint8], timeout: Duration = ...) -> Result[None, io.Error]
net.TcpStreamflushflush() -> Result[None, io.Error]
net.TcpStreamlocal_addrlocal_addr() -> Result[str, io.Error]
net.TcpStreampeer_addrpeer_addr() -> Result[str, io.Error]
net.TcpStreamshutdown_readshutdown_read() -> Result[None, io.Error]
net.TcpStreamshutdown_writeshutdown_write() -> Result[None, io.Error]
net.TcpStreamshutdown_bothshutdown_both() -> Result[None, io.Error]
net.TcpStreamcloseclose() -> None
net.UdpSocketsend_textsend_text(address: str, text: str, timeout: Duration = ...) -> Result[None, io.Error]
net.UdpSocketsend_bytessend_bytes(address: str, bytes: list[uint8], timeout: Duration = ...) -> Result[None, io.Error]
net.UdpSocketrecvrecv(max_bytes: int32, timeout: Duration = ...) -> Result[list[uint8] | None, io.Error]
net.UdpSocketrecv_fromrecv_from(max_bytes: int32, timeout: Duration = ...) -> Result[net.UdpDatagram | None, io.Error]
net.UdpSocketlocal_addrlocal_addr() -> Result[str, io.Error]
net.UdpSocketpeer_addrpeer_addr() -> Result[str, io.Error]
net.UdpSocketcloseclose() -> None
net.UdpDatagramaddressaddress() -> str
net.UdpDatagrambytesbytes() -> list[uint8]
net.UdpDatagramtexttext() -> Result[str, io.Error]
net.HttpListeneracceptaccept(timeout: Duration = ...) -> Result[net.HttpExchange, io.Error]
net.HttpListenerlocal_addrlocal_addr() -> Result[str, io.Error]
net.HttpListenercloseclose() -> None
net.HttpExchangemethodmethod() -> str
net.HttpExchangepathpath() -> str
net.HttpExchangeheadersheaders() -> dict[str, str]
net.HttpExchangebody_textbody_text() -> Result[str, io.Error]
net.HttpExchangebody_bytesbody_bytes() -> list[uint8]
net.HttpExchangerespond_textrespond_text(status: int32, text: own str, headers: own dict[str, str]) -> Result[None, io.Error]
net.HttpExchangerespond_bytesrespond_bytes(status: int32, bytes: own list[uint8], headers: own dict[str, str]) -> Result[None, io.Error]
net.HttpResponsestatusstatus() -> int32
net.HttpResponsereasonreason() -> str
net.HttpResponseheadersheaders() -> dict[str, str]
net.HttpResponsetexttext() -> Result[str, io.Error]
net.HttpResponsebytesbytes() -> list[uint8]
net.WebSocketListeneracceptaccept(timeout: Duration = ...) -> Result[net.WebSocket, io.Error]
net.WebSocketListenerlocal_addrlocal_addr() -> Result[str, io.Error]
net.WebSocketsend_textsend_text(text: str, timeout: Duration = ...) -> Result[None, io.Error]
net.WebSocketsend_bytessend_bytes(bytes: list[uint8], timeout: Duration = ...) -> Result[None, io.Error]
net.WebSocketrecv_textrecv_text(timeout: Duration = ...) -> Result[str | None, io.Error]
net.WebSocketrecv_bytesrecv_bytes(timeout: Duration = ...) -> Result[list[uint8] | None, io.Error]
net.WebSocketcloseclose() -> None
net.UnixListeneracceptaccept(timeout: Duration = ...) -> Result[net.UnixStream, io.Error]
net.UnixListenercloseclose() -> None
net.UnixStreamread_lineread_line(timeout: Duration = ...) -> Result[str | None, io.Error]
net.UnixStreamread_exactread_exact(count: int32, timeout: Duration = ...) -> Result[list[uint8], io.Error]
net.UnixStreamwrite_allwrite_all(text: str, timeout: Duration = ...) -> Result[None, io.Error]
net.UnixStreamcloseclose() -> None
net.TlsListeneracceptaccept(timeout: Duration = ...) -> Result[net.TlsStream, io.Error]
net.TlsListenerlocal_addrlocal_addr() -> Result[str, io.Error]
net.TlsListenercloseclose() -> None
net.TlsStreamread_lineread_line(timeout: Duration = ...) -> Result[str | None, io.Error]
net.TlsStreamread_exactread_exact(count: int32, timeout: Duration = ...) -> Result[list[uint8], io.Error]
net.TlsStreamwrite_allwrite_all(text: str, timeout: Duration = ...) -> Result[None, io.Error]
net.TlsStreamcloseclose() -> None

Process ​

Process Module covers defaults, process groups, and supervisor behavior.

APISignature
process.inheritinherit() -> process.Stdio
process.nullnull() -> process.Stdio
process.pipepipe() -> process.Stdio
process.supervisorsupervisor() -> process.Supervisor
process.startstart(command: list[str], cwd: str | None = ..., env: dict[str, str] = ..., stdin: process.Stdio = ..., stdout: process.Stdio = ..., stderr: process.Stdio = ..., group: bool = ...) -> Result[process.Child, process.Error]
process.runrun(command: list[str], cwd: str | None = ..., env: dict[str, str] = ..., stdin: process.Stdio = ..., stdout: process.Stdio = ..., stderr: process.Stdio = ..., timeout: Duration = ..., group: bool = ...) -> Result[process.Completed, process.Error]
process.Child.stdinstdin() -> process.Pipe | None
process.Child.stdoutstdout() -> process.Pipe | None
process.Child.stderrstderr() -> process.Pipe | None
process.Child.waitwait(timeout: Duration = ...) -> process.Wait
process.Child.wait_or_nonewait_or_none(timeout: Duration = ...) -> Result[process.ExitStatus | None, process.Error]
process.Child.wait_okwait_ok(timeout: Duration = ...) -> Result[process.ExitStatus, process.Error]
process.Child.killkill() -> Result[None, process.Error]
process.Child.terminateterminate() -> Result[None, process.Error]
process.Child.closeclose() -> None
process.Pipe.read_allread_all() -> Result[str, process.Error]
process.Pipe.read_lineread_line(timeout: Duration = ...) -> Result[str | None, process.Error]
process.Pipe.read_bytesread_bytes(max_bytes: int32, timeout: Duration = ...) -> Result[list[uint8] | None, process.Error]
process.Pipe.write_allwrite_all(text: str, timeout: Duration = ...) -> Result[None, process.Error]
process.Pipe.write_byteswrite_bytes(bytes: list[uint8], timeout: Duration = ...) -> Result[None, process.Error]
process.Pipe.flushflush() -> Result[None, process.Error]
process.Pipe.closeclose() -> None
process.Completed.statusstatus() -> process.ExitStatus
process.Completed.successsuccess() -> bool
process.Completed.stdoutstdout() -> str
process.Completed.stdout_bytesstdout_bytes() -> list[uint8]
process.Completed.stderrstderr() -> str
process.Completed.stderr_bytesstderr_bytes() -> list[uint8]
process.Completed.checkcheck() -> Result[None, process.Error]
process.Supervisor.startstart(name: own str, command: own list[str], cwd: own (str | None) = ..., env: own dict[str, str] = ..., stdin: own process.Stdio = ..., stdout: own process.Stdio = ..., stderr: own process.Stdio = ..., restart: own process.RestartPolicy = ..., backoff: own Duration = ..., max_restarts: own int32 = ..., group: own bool = ...) -> Result[None, process.Error]
process.Supervisor.waitwait(timeout: Duration = ...) -> process.SupervisorWait
process.Supervisor.wait_or_nonewait_or_none(timeout: Duration = ...) -> Result[process.SupervisorEvent | None, process.Error]
process.Supervisor.stopstop() -> Result[None, process.Error]
process.Supervisor.is_emptyis_empty() -> bool
process.Supervisor.closeclose() -> None

Pipe read_bytes returns Ok(None) only at end of file. Timeout and cancellation are process.Error variants. Whole and captured reads are capped at 64 MiB.

process.Completed.stdout() and .stderr() raise a runtime diagnostic on invalid UTF-8. Use the byte accessors to read untrusted output safely.

Builtin Enum Variants ​

Each builtin enum and its variants, with payload fields.

TypeVariants
Lookup[T]Found(value: own T), Missing
Poll[T]Ready(value: own T), Unavailable
Result[T, E]Ok(value: own T), Err(error: own E)
SendError[T]Closed(value: own T), Cancelled(value: own T), TimedOut(value: own T), Full(value: own T)
QueueReceive[T]Item(value: own T), Closed, TimedOut, Cancelled
TaskResult[T]Ready(value: own T), Error(message: own str), TimedOut, Cancelled
SelectOutcome[Q, T]Queue(index: own int64, outcome: own QueueReceive[Q]), Task(index: own int64, outcome: own TaskResult[T]), Deadline(index: own int64), Cancelled
WaitAny[T]Ready(index: own int64, value: own T), Error(index: own int64, message: own str), TimedOut, Cancelled
WaitAll[T]Ready(values: own list[T]), Error(index: own int64, message: own str), TimedOut, Cancelled
bytes.ErrorInvalidUtf8(index: own int32), InvalidHexLength(length: own int32), InvalidHexDigit(index: own int32, byte: own uint8), InvalidBase64(index: own int32)
io.ErrorNotFound, PermissionDenied, AlreadyExists, IsDirectory, ConnectionRefused, ConnectionReset, ConnectionAborted, NotConnected, AddrInUse, AddrNotAvailable, BrokenPipe, TimedOut, WouldBlock, UnexpectedEof, InvalidInput, InvalidData, Closed, Cancelled, Other(message: own str)
process.StdioInherit, Null, Pipe
process.ExitStatusExited(code: own int32), Signaled(signal: own int32)
process.WaitExited(status: own process.ExitStatus), TimedOut, Cancelled, Failed(error: own process.Error)
process.RestartPolicyNever, OnFailure, Always
process.ErrorNoCommand, TimedOut, Cancelled, Io(error: own io.Error), Spawn(message: own str), Other(message: own str)
process.SupervisorEventExited(name: own str, status: own process.ExitStatus, restart_count: own int32), Restarted(name: own str, status: own process.ExitStatus, restart_count: own int32), Failed(name: own str, error: own process.Error, restart_count: own int32)
process.SupervisorWaitEvent(event: own process.SupervisorEvent), TimedOut, Cancelled

Design records: ADR-0019 for Duration conversion, ADR-0032 for task stack sizes, and ADR-0033 for Transfer, task results, and Queue payloads.

Aura 0.6.0 technical preview. Implementation baseline: 4d7e076de9ff6e2e056cdec10881d4bf421358de.