Skip to content
This repository was archived by the owner on Nov 19, 2026. It is now read-only.

Brevi v0.24.3

Choose a tag to compare

@github-actions github-actions released this 03 Nov 19:08
f61bd0b

brevi check gives its verdict in well under a second, and checking or running an unchanged program again replays the cached result in about 10 ms: the median check of a new file went from 559 ms to 144 ms (60 of 65 programs under a second, up from 40), and a re-check from 60 ms to 8 ms median. Standard-library calls now run natively instead of in CPython (of 47 probe programs, 19 needed CPython before and 5 now), math and time are on the fast typed path (a math.sqrt/math.log loop over 20 million numbers takes 0.09 s, CPython 1.9 s), and two silent wrong outputs are fixed (re.findall with groups, reading a missing defaultdict key). No new release-test run; the v0.24.2 figures stand.

  • Faster check, and repeated calls are near-instant. Agents call brevi check and brevi run over and over, so every call's wait counts. Three changes, measured on 65 programs (the release suite's saved repros and saved solutions; table in the pull request): (1) check and run made all eight versions of the generated program up front, each a whole parse and type-inference pass, even when the first one built or was cached; now the others are made only when the ones before fail. (2) A new result cache: check, build and run of files that did not change replay the last result (the same output, {"path":...} line and binary) without parsing, inference or rustc, keyed on a hash of the program's files, the command and flags, the BREVI_* and Python settings, the Brevi binary and the toolchain. A re-check of an unchanged file went from 344 ms on average (up to 3.9 s) to 11 ms, a re-run from 379 ms (up to 4.7 s) to 18 ms. A refusal is replayed only for programs that import nothing an install could change. The MCP server gets this with no change. (3) check of a file on the dynamic path runs rustc's checks instead of a full build (2.8 s to 0.5 s on one program). Type inference also copies its name tables less. --no-cache (or BREVI_NO_CACHE=1) builds from scratch, BREVI_CACHE_MB caps the cache (default 1024 MB, least recently used out first; it was 400 entries), and BREVI_TIME=1 prints how long each build stage took. Also fixed: a build into a folder that did not exist left its error in the build cache, so building again after creating the folder still failed.
  • Standard-library calls run natively, not in CPython. A Python file that the typed build could only finish by handing some standard-library calls to CPython (math.gcd, itertools.product, statistics.mean, copy.deepcopy, datetime.datetime.strptime, functools.reduce, time.perf_counter) now takes the dynamic build, which has those modules natively: no libpython at run time, and it works under --sandbox. Libraries Brevi lacks (numpy, sqlite3) still run in CPython as before. Of 47 small standard-library probe programs, 19 needed CPython before and 5 now (argparse, textwrap, io, os and random; random and textwrap come next); in the 765-program corpus 11 programs moved from CPython to native, and every moved program with tests prints what python3 prints. Also fixed: one missing call such as math.gcd sent every math. call on its line to CPython, math.sqrt included.
  • Silent wrong output fixed: re.findall with groups. With two or more groups re.findall returns tuples ([('a', '1'), ('b', '2')]), but the typed build gave whole matches (['a1', 'b2']). Such calls now build over dynamic values; with no group or one group they stay typed.
  • Silent wrong output fixed: reading a missing defaultdict key. In Python d[k] on a defaultdict puts the key in, so len(d), loops and printing see it; the typed build left the dict unchanged. A program that reads a defaultdict with a key that may be missing and also looks at its keys now builds over dynamic values (a key taken from a loop over the dict's keys, or from min/max of them, counts as found, so counting and grouping programs stay typed: 1 of the 765 corpus programs moved).
  • math and time on the fast typed path. math.gcd, lcm, comb, perm, factorial (big results grow past 64 bits as in Python), isclose, log (with or without a base), log2, log10, log1p, exp, expm1, sin, cos, tan, asin, acos, atan, atan2, the hyperbolic functions, hypot, fabs, trunc, degrees, radians, copysign, fmod, isnan, isinf, isfinite, the constants pi, e, tau, inf and nan, and time.time, perf_counter and monotonic now build typed, whether imported with import math or from math import gcd, pi. Domain errors are a ValueError an except catches, as in CPython, and math.sqrt(-1) raises instead of giving nan. A loop of math.sqrt and math.log over 20 million numbers runs in 0.09 s (CPython: 1.9 s). Of the 47 probes, math and time programs moved from the dynamic build to the typed one; no program in the corpus left the typed path.
  • Docs: a What runs native table lists, module by module, which functions the typed build has, which run in the dynamic build, and which still need CPython.

Prebuilt brevi compiler for Linux, macOS and Windows. brevi still needs rustc on the PATH to build programs. On Linux and macOS, sh install.sh installs rustc if it is missing and picks the right download; on Windows, install Rust with rustup and unzip the .zip. Details: https://brevi-lang.org/docs/install