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

Brevi v0.25.0

Choose a tag to compare

@github-actions github-actions released this 04 Nov 14:00
0f08089

The launch release, out ahead of the weekly Monday release. Most of it is correctness: Brevi now measures itself against CPython's own test suite (tools/conformance.py), and the fixes it led to cut built programs that give a wrong answer there from 79 to 45 while the share of tests that match rose from 49.2% to 57.9%; every other silent wrong output found in the release runs is fixed too, including d.copy() and list(d) on a dict in typed builds. 567 of 813 saved agent programs now take the fast typed build, with none differing from CPython. Python files exit 1 on an uncaught exception, Brevi-only syntax in a .py file is refused as CPython refuses it, install.sh checks its download against SHA256SUMS, and the dynamic build's re beats CPython on search loops. Release test, two runs on the release tree: Sonnet 1.09x and Haiku 1.01x the cost of CPython, every task passed, no check failed because of Brevi, 95 of 96 final programs native (two earlier runs on the tree just before #207: 1.04x and 1.05x, 96 of 96).

  • Composio example. integrations/composio_agent.py gives a LangChain agent Composio's hosted MCP server for app tools (GitHub issues here) next to brevi mcp. Composio holds the credentials and makes the calls; the data reaches Brevi's run as stdin, so the agent's program runs sandboxed with nothing granted.
  • Silent wrong output fixed: list items that start with \x01. On the typed path print(["\x01a", "b"]) printed ['b'], because regex matches kept their group positions as a hidden last string and printing a list dropped any such string. A match is now its own type holding the positions apart, so a list shows every item, printing a match shows <re.Match object; ...>, and m.group(9), m[-1], len(m) and for x in m fail as in CPython instead of exposing the hidden text. (#200, thanks @timoconnellaus)
  • CPython conformance measure. tools/conformance.py cuts each test of CPython 3.13.13's test_grammar, test_scope, test_int, test_list and test_dict into a standalone script and compares brevi build output with CPython's: at first 49.2% of 311 scored tests matched (153), 59 were refused and 79 built programs gave a wrong answer; after the fixes below from that run, 57.9% match (180), 67 are refused and 45 give a wrong answer (57.6% and 45 with BREVI_DYN=1). Report; --check fails only on a wrong result not in compat/conformance_known_wrong.txt. Not in CI. (#199, thanks @timoconnellaus)
  • install.sh verifies its download. The script now checks the release archive against the release's SHA256SUMS before unpacking it, and stops with nothing installed on a mismatch or when the check cannot be made (BREVI_FROM_SOURCE=1 still builds from source). (#198, thanks @timoconnellaus)
  • time.gmtime, time.strftime and datetime.timezone build natively (#194). The dynamic build refused them, so a shared module formatting a UTC timestamp sent 23 of the 27 files of the pipeline in #175 to CPython. Now time.gmtime() gives a time.struct_time (fields, indexing, tm_zone), time.strftime(fmt, t) formats it, and time.time_ns() is there. Datetimes can be aware: datetime.timezone.utc, datetime.UTC, timezone(timedelta(...)), tzinfo= in datetime(...), combine(d, t, tz), replace(tzinfo=...), now(tz), fromtimestamp(ts, tz), utcfromtimestamp, astimezone(tz), timestamp(), utcoffset(), tzname(), %z/%Z, offsets in isoformat(), str() and repr(), comparison and subtraction as instants, and CPython's error for mixing naive and aware datetimes. fromisoformat("...Z") and "...+02:00" now give aware datetimes; before, the Z was dropped and the result was naive (silent wrong output). Local time (time.localtime, strftime without a tuple, a naive timestamp(), fromtimestamp without tz) still runs in CPython. Aware datetimes passed to a Python library keep their offset.
  • A dynamic-build blocker in an imported module names that module's file (#194). brevi check main.py said main.py line 4: time.gmtime is not supported when line 4 was in _m.py; it now says _m.py line 4, in check, in run's path line and in --explain.
  • (x or "").lower() on a JSON value builds typed (#195). x or "" where x came from json.loads was typed as a bool, so the typed build's Rust did not compile and the file took the slower dynamic build. A JSON value or a string or int is now a JSON value. Also: re.search, re.sub, re.findall and friends on a JSON string build typed (they stopped the typed build with no method named re_find found for enum Json).
  • json.load(open(path)) builds typed (#195). It stopped check with unknown function __open_r(), which read like an internal error; it now reads the file as with open(path) as f: json.load(f) does. Other uses of an open() file the typed build cannot take (passing it to a function, for example) get a plain message instead.
  • The dynamic build's re is faster than CPython on search loops (#195). A search now skips straight to the characters a match can start with (also after \b, ^ or \A, and with re.I), a one-character pattern such as [^a-z ] scans without backtracking, and searching one text with many patterns converts the text once. On a stand-in for the issue's bench (re.search(rf"\b{w}", scene, re.I) over 147 topics and 79 scenes, plus re.sub) the dynamic build went from 0.86x to about 1.8x CPython's speed.
  • Silent wrong output fixed: \N{NAME} in .py files. print("\N{BULLET} item") printed the escape as text on the typed path and sent the program to CPython from the dynamic build. Both builds now resolve names (any case, aliases) from a table in the compiler, 400 KB of binary size; a bad name, or a computed CJK UNIFIED IDEOGRAPH-/HANGUL SYLLABLE one, is refused and left to CPython. (#185, thanks @timoconnellaus)
  • Silent wrong output fixed: float sum(). Typed builds added floats one by one, so sum([0.1] * 10) printed 0.9999999999999999 and sum([1e100, 1.0, -1e100]) printed 0.0. Every typed float sum (lists, generators, JSON numbers, Python library values, sum(xs, start)) is now compensated as in CPython 3.12+ and the dynamic build, and sum([-0.0]) prints 0.0. (#190, thanks @timoconnellaus)
  • Uncaught exceptions in Python files exit 1, as in CPython. Native typed builds exited 101, Rust's panic status, and bench/compare/compare.py hid it by only comparing zero with non-zero; it now compares exact exit codes. .bv programs still exit 101 after a runtime error. (#187, thanks @timoconnellaus)
  • A .py file with Brevi-only syntax or methods is refused, as CPython refuses it. if a && b:, x => x + 1, fn f(x):, 0..n, true, fail("x") and xs.push(1) on a list used to build and print an answer; now check and build report one error with the Python spelling and brevi run falls back to CPython, which gives the real error. A class's own push still works, and .bv files keep every Python spelling. (#189, thanks @timoconnellaus)
  • Silent wrong output fixed: print arguments and tuple items changed by a later one. print(xs, grow(xs)), where grow changes the list (or a global, or self), printed the list from before the change in typed builds, and r = (q, q.pop()) kept a copy of q; both now go to the dynamic build and print what python3 prints. None of the 580 saved solutions moved off the typed path. (#188, thanks @timoconnellaus)
  • Silent wrong output fixed: a Python file the guard could not read. When the dynamic parser could not read a file (or a module it imports) that the typed build accepted, such as one using except*, every guard check was skipped, so print({3, -1, 5}) printed the set sorted. Such a file is no longer built typed: brevi run runs it with python3, and build and check report an error. Files with a bare allow line now get the guard's checks too. (#191, thanks @timoconnellaus)
  • Silent wrong output fixed: d.copy() and list(d) on a dict in typed builds. d.copy() gave the dict's keys, so print(d.copy()) showed {'a'} for {'a': 1}, and list(d) printed as a set ({'a'} for ['a']). d.copy() is now a copy of the dict (also with tuple keys) and list(d) a list of its keys. Found from the conformance run.
  • Silent wrong output fixed: comparing dict views in typed builds. d.items() <= e.items() and d.keys() == {1, 2} follow set rules in CPython; the typed build compared them as lists. Programs that compare keys(), items() or values() with <, <=, >, >=, == or != now take the dynamic build, which now compares key and item views with sets and with each other as CPython does (values() views compare by identity, so d.values() == d.values() is False). Found from the conformance run.
  • Dict subclasses in dynamic builds: __missing__ and dict(mapping). d[k] on a dict subclass with __missing__ now calls it for a missing key (a Counter-style c[k] += 1 works), and dict(sub), dict(obj) and d.update(obj) copy a dict subclass, or any object with keys() and __getitem__, as CPython does instead of giving an empty dict.
  • A class with __del__ runs in CPython. Both builds free objects at other times than CPython, so a __del__ that counts or logs ran at the wrong moment or not at all. brevi run now runs such a file with python3 and says why; build and check refuse it.
  • Silent wrong output fixed: return inside try/finally in typed builds. A function whose try body returned, with a finally after it, returned None in typed builds and the finally never ran; break and continue out of such a try skipped the finally too. These programs now take the dynamic build, which runs the finally as CPython does. try/except without a finally stays typed. Found by the CPython conformance run (#199).
  • Silent wrong output fixed: string escapes in typed builds. 'say \"hi\"' and "don\'t" kept the backslash (don\'t, and a length of 2 for "\'"), and a backslash at the end of a line inside a string was kept instead of joining the lines.
  • Silent wrong output fixed: for k in obj over a JSON object in typed builds walked nothing; it now walks the keys (and a JSON string's characters), as in Python. Seen once meta = d.get("meta") or {} built typed.
  • issue["labels"] or [] and d.get(k) or {} on JSON build typed. They stopped the typed build with the trait bound `bool: AxEach` is not satisfied and took the slower dynamic build.
  • Dynamic builds raise CPython's errors in more places (from the conformance run): a list, dict or set method that takes no arguments raises TypeError when given one (xs.clear(None), d.items(1)); deleting a dict key and adding another while looping over the dict raises RuntimeError: dictionary keys changed during iteration; a slice step, xs.index() bound or int() base past 64 bits is clamped or refused as in CPython instead of stopping with IndexError: cannot fit 'int' into an index-sized integer.
  • Silent wrong output fixed: "%d items" % (n,) in typed builds. A string % a one-item tuple printed the item as a list ([3] items, ['a']), because the typed build keeps (x,) as a one-item list. It now fills in the item, as CPython does.
  • Silent wrong output fixed: one-item tuples shown whole. print((5,)), a list or dict holding (x,), an f-string of one, or one returned from a function or passed to one printed [5] in typed builds. These programs now take the dynamic build and print (5,). The check follows only the one-item tuple itself, so a real tuple that holds one ((n, path + (u,)), read back by index) stays typed.
  • A module file with a triple-quoted string over several lines is no longer refused. TOKEN_RE = re.compile(r'''...''', re.X) in an imported .py file stopped the build with a used file holds only fn, type, enum and test items at the pattern's second line. Seen in a release-run json_query program, which now builds and passes its tests.
  • import json.decoder works in dynamic builds. json.decoder.scanstring(...) after import json.decoder was refused (json.decoder is not supported in dynamic builds), and in a file the typed build also could not take, the build failed outright. Seen in a release-run json_query program, which now builds natively and passes its tests.
  • e2e.py --verdict no longer passes on nothing. A log glob that matched no files printed release test PASSED; it now stops with an error. --verdict exits 1 when the bar is missed, and a run without the anthropic package or BENCH_ANTHROPIC_KEY says what to install or set.
  • The result cache no longer replays a refusal caused by the machine. When the dynamic build's runtime library could not be built (many builds starting on a cold cache at once, a full disk) or rustc was killed, a Python file was refused with the typed build's reason, such as cannot work out the type of s, and that refusal was kept and shown again on later runs until the cache was cleared. Such failures are now never kept, and a crate rustc could not load is no longer cached as an error in the program. Seen in the v0.24.6 release run.

Contributors: thanks to @timoconnellaus for their work in this release.

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