Nox

Start here

What's new in Nox 2.0

Nox 2.0 is the first release with a stability promise across the language, the standard library and the native interface (Stability). It completes the Python-like language surface, makes both back ends behave identically, introduces the three public APIs, and ships complete documentation. If you are upgrading from 1.x, start with Migrating from 1.x.

A complete everyday language#

Python's day-to-day syntax is now covered, with static types:

  • Control flow: break/continue, chained comparisons (0 <= i < n), in/not in, conditional expressions, assert, for over ranges with steps, strings, dictionaries and any list expression; custom iteration with __iter__.
  • Functions: default and keyword arguments (evaluated left to right as written), lambdas, closures, first-class functions and bound methods, higher-order generics with inference from lambdas, generic classes and generic methods.
  • Data: tuples with unpacking and multiple return, set[T] with literals and operators, full list and dictionary APIs, negative indexing, slicing (xs[1:-1], s[::-1]), list/dictionary/set comprehensions and generator expressions as call arguments.
  • Classes: single inheritance with super(), a complete special-method protocol (__add__, __eq__, __lt__, __getitem__, __contains__, __len__, __iter__, __str__, __repr__, __bool__, …), structural protocols, class docstrings.
  • Strings: f-strings with the full format mini-language, str.format, triple-quoted strings, dozens of string methods, str()/repr() of any value, Python-compatible float printing.
  • Numbers: hexadecimal/binary/octal/underscore literals, exact round(x, n), fixed-width integers (u8…i64) with overflow traps, exact integer **.
  • Errors: except (A, B) as e, finally, with, defer, ZeroDivisionError, readable syntax errors with file, line, column and a caret.
  • Concurrency: tasks, channels, cooperative cancellation, task-local values, a multi-core work-stealing scheduler.

The same program on both back ends#

LLVM is now the default back end (about 1.5× the time of C across a mixed benchmark suite), and both back ends produce identical output: fixed-width overflow traps on both, plain int wraps on both, keyword arguments evaluate in source order on both. A differential test runs the entire corpus on both on every release. clang is no longer required: the compiler falls back to zig cc, and then to QBE. Windows is supported end to end through zig cc.

Three public APIs#

  • NAPI — what framework and library authors may rely on, with a constructor-freeze policy for standard-library classes.
  • NNI v1 — a stable C ABI for native extensions in C, C++, Rust and Zig, with opaque generation-counted handles, thread-safe events and an optional shutdown hook.
  • Plugin API — manifests, version negotiation, typed call checking, registration cross-checks and capability consent.

A larger standard library#

New or greatly extended: nox.collections (stack, queue, deque, counter, ordered map, LRU cache, heap, priority queue), nox.binary/nox.buffer/nox.bits for binary formats, nox.mem and typed pointers for systems code, nox.atomic, nox.sharedmem, nox.url, nox.base64, nox.jwt, nox.crypto (SHA-2, HMAC, Argon2id/bcrypt/scrypt), nox.toml/nox.yaml/nox.csv, nox.sqlite/nox.postgres/nox.mysql with nox.orm, nox.websocket and nox.tls, server-side TLS and WebSocket upgrade, a router with query strings and middleware, nox.validate with nested schemas, nox.reflect, nox.native, nox.plugin. See the standard library reference — every module is documented.

Tooling and ecosystem#

  • noxc gains check, explain, expand, fmt, add, delete, publish, install, upgrade, test, cache prune; a real formatter; an LSP server; a VS Code extension and a tree-sitter grammar.
  • A central package index, noxpkg, with moderated publishing, and signed-commit verification for dependencies.
  • The Nyx web framework and the Aether framework are built on Nox 2.x.

Systems programming#

Fixed-width integers, ptr[T], volatile access, @repr("C")/@packed layouts, @ffi.callback, --profile freestanding with a kernel-provided allocator, multiple target architectures, and a complete demo kernel written in Nox.

Quality#

Roughly 1,250 tests across 180 build steps, fuzzing of the front end, concurrency torture suites, an HTTP soak test, differential testing of back ends, and CI on Linux x86-64, Linux aarch64, macOS and Windows. A release is published only after CI is green on the tagged commit.

Breaking changes#

The deprecated nox.json and nox.csv aliases are gone; a few behaviours changed to match Python expectations (float printing, negative indexes, overflow traps, zero division). The complete list, with fixes, is in Migrating from 1.x.

Known limits in 2.0#

*args/**kwargs and multiple inheritance are not part of 2.0 (adding them later does not break existing code). Tasks and channels cannot be stored in collections (gather results through a channel). list[Protocol] is not supported (use a base class). Diagnostic and library messages are currently written in Turkish. The language reference lists all current differences from Python.