Skip to content

Releases

Pystachy v0.7.0-rc.1

Pystachy v0.7.0-rc.1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 23 Nov 08:40
c0f7d7f

Pystachy v0.7.0-rc.1 freezes the v0.7.0 feature set for final qualification. Since alpha.3, objects of class templates read a class attribute's current value, and NamedTuple and integer or string enum classes that define only __eq__ keep the builtin !=. Pystachy remains an experimental compiler for a typed subset of Python.

Corrections since alpha.3

  • Objects of a class template, and of a subclass of one, read a class attribute with its current value after the program rebinds it through the class, as in Box.limit = 10 or cls.limit += 1, until they assign it themselves. Alpha.3 kept the original value. (#1724, #1726, #1727, typing)
  • A NamedTuple, IntEnum, IntFlag or StrEnum class that defines __eq__ but not __ne__ keeps the builtin !=, as CPython does: Pair(1) != "" is True. Previously != inverted the class's __eq__. (#1738)
  • The threading module's dynamic Any opt-in is recorded as a contract, with a test of the timers and argument packs that need it. (#1734, dynamic Any boundaries)

Features carried from the alphas

  • Classes and typed IR: nested and local classes, subclasses of list, dict and collections.abc classes, __getattr__, int where float is annotated, most of enum, and the typed IR as a checked text form with source locations. Alpha.1
  • WebAssembly and installation: an experimental WebAssembly target for snippets from a source checkout, fewer library modules that need dynamic Any, and pystachy doctor. Alpha.2
  • Errors, templates and verification: CPython-style tracebacks in executables, subclasses of class template specializations, tuples in closed unions, == that falls back to the reflected method and identity, pystachy check --semantic, generators and callbacks in the direct Wasm backend, and more typed IR verifier checks. Alpha.3

Known limits

Two wrong results from alpha.3's class changes remain for the next candidate. An object of a list or dict subclass reaches another class's __eq__, __ne__ or ordering method as a plain list or dict, where alpha.2 rejected the program (#1739). A class method that assigns cls.x, called through an object of a subclass of a class template, changes the base class's attribute instead of giving the subclass its own (#1744).

Dynamic Any and promoting integers remain experimental opt-ins, and the WebAssembly target runs only from a source checkout. Known issues that predate the alphas include star imports from packages without a top-level export list (#1513), reads of a builtin's name where a module global of that name is unbound (#1512), an except clause's as name that an import bound (#1514) and isinstance() tests against a second base class (#1602).

The verifier's allocation cost under GC stress and the remaining Lean report rejections are still tracked (#1644, #1643). The compatibility reference lists the documented deviations.

Moving the list and string core into runtime.py, Protocol and object storage, and the portable LLVM download wait for 0.8.0. Fixes found after this candidate ship in a second candidate or in v0.7.0.

Platforms

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages. This prerelease keeps the stable defaults at v0.6.1.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.7.0-rc.1 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: c0f7d7f6753b2c3c7b282feb81e520924d566813.

Pystachy v0.7.0-alpha.3

Pre-release

Choose a tag to compare

@github-actions github-actions released this 23 Nov 04:06
e124b71

Pystachy v0.7.0-alpha.3 makes compiled executables print CPython-style tracebacks. It extends class templates and closed unions, and lets the experimental WebAssembly backend compile generators and callbacks directly. This is the last alpha of 0.7.0: its release candidates take fixes only. LLVM remains the default native backend. Pystachy is an experimental compiler for a typed subset of Python.

Errors and the command line

  • An uncaught exception in an executable prints a traceback with the file, line and function of each frame, as CPython does. build now gives a program's functions line tables, which the traceback reads; PYSTACHY_DEBUG_LINES=0 leaves them out. Chained exceptions, macOS and Wasm still print only the final line. (#1710, errors and cleanup)
  • pystachy check --semantic FILE.py compiles a file without LLVM and reports its first error. pystachy build accepts -O0, -O1, -O2 and -g after the source file. pystachy doctor prints the runtime cache as an absolute path. The getting-started guide lists valid source that the pre-commit hook rejects. (#1693, #1694, #1691, #1690)

Typing and libraries

  • A class can derive from a specialization of a class template, with a templated __init__ and template-typed fields. A closed union can hold one tuple type, and recursive aliases are named by their shape and type arguments. (#1707, #1716, #1698, #1699, typing)
  • == between an object and a value of another type calls the left operand's __eq__, then the reflected one, then compares identity, as CPython does. (#1706)
  • Enum classes held in class attributes, sys.float_info attributes in class bodies, and typing.Pattern[str], Match[str] and IO[str] annotations compile. zlib.crc32() and zlib.adler32() are available. (#1686, #1665, #1674, #1687, #1668)
  • Fixes: star imports follow a conditional __all__ and a package's current exports. abs() of a nonnegative integer keeps its identity. Chained __class__() constructors compile in linear rather than exponential time. The threading port releases discarded Thread objects. (#1669, #1684, #1688, #1664, #1682)

WebAssembly from a source checkout

  • The direct backend compiles typed callbacks and plain generators, keeps a generator's typed state across suspension, and dispatches static object callbacks through the module's table. Builtin container subclasses get wasm32 header layouts. (#1675, #1676, #1678, #1679, #1680, #1683, Wasm setup)
  • Fixes under WASI: nested handlers unwind to the enclosing one, and *args tuples and vars() fields keep the wasm32 layout. The collector traces whole pointer words, and zero-length writes no longer move file positions. float("-nan") and math.fma keep their signs. The Wasmtime runner forwards piped input, and WASM_EH=standard builds enable the reference types that Binaryen's exception conversion needs. wasm/check_corpus.py compares the corpus with a list of explained differences. (#1695, #1696, #1677, #1705, #1708, #1709, #1681, #1697)

Verification

  • Typed IR text carries a format version. With PYSTACHY_IRCHECK=1, the verifier also checks that control flow is structured and proves reads of objects at narrower classes. (#1700, #1701, #1702, #1704)
  • The compiler infers its own types in one attempt, which the bootstrap now requires. Each dynamic Any opt-in in the library is recorded as a contract or as tracked debt. (#1714, #1713, dynamic Any boundaries)

Installation and limits

  • Supported platforms are unchanged from alpha.2. The distributed Linux archives require glibc 2.39+ and LLVM 18. The macOS archives require macOS 15+, Xcode Command Line Tools and LLVM 20. (installation)
  • Objects of a class template, and of a subclass of one, keep reading a class attribute's original value after the program rebinds it through the class's name; a release candidate will fix this. (#1724)
  • Moving the list and string core into runtime.py, Protocol and object storage, and the portable LLVM download wait for 0.8.0. The verifier's allocation cost under GC stress and the remaining Lean report rejections are still tracked. (#1644, #1643)

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.7.0-alpha.3 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: e124b71e1ef13dde1afad24bb747bb1621285262.

Pystachy v0.7.0-alpha.2

Pre-release

Choose a tag to compare

@github-actions github-actions released this 21 Nov 12:02
4998521

Pystachy v0.7.0-alpha.2 adds an experimental WebAssembly target for Python snippets, reduces the number of modules that need dynamic Any, and adds a command for diagnosing local installations. LLVM remains the default native backend. Pystachy is an experimental compiler for a typed subset of Python.

WebAssembly from a source checkout

  • A Node host can compile once and rerun a snippet with fresh memory and tool grants. The optional Python host runs the same program routes on Wasmtime 51 with standard exception encoding and per-run fuel and memory limits. The direct backend reads finalized typed IR. When it encounters an unsupported operation, it reports the reason and can reuse the same compilation to build through LLVM/WASI. (Wasm setup and examples, #1641, #1642, #1654)
  • Both routes support Python exception handlers across calls. Generators use the LLVM route. The direct backend supports static exception descriptors, masked 32-bit arithmetic, and typed JSON tool results. WASI error numbers can differ from Linux. Node's execution timeout covers instantiation and execution. Compilation and blocking native callbacks require separate supervision. (#1652, #1653, #1659, #1660)
  • A complete typed IR text module can be read back into the same compiler and lowered to LLVM. The tool reports the state it cannot reconstruct, including extension entry points and LLVM debug line tables. (#1636)

Typing and runtime

  • Closed unions support more arithmetic and container operations. pathlib and more of the JSON repair port compile without a module-level dynamic Any opt-in. Arithmetic-only parameters in eligible kernels keep their unboxed representation. (#1632, #1648, #1650, #1651)
  • Reinitializing a list subclass from an iterator, checking a container subclass against collection ABCs, and falling back to builtin arithmetic when a subclass overrides another operator now follow CPython. (#1661)
  • The JSON repair parser preserves mutable object and log aliases. Closed-union equality compares its active member with a promoting integer at full width. Integer members stored in recursive unions still fit in 64 bits. (#1655, #1656)
  • The IR verifier reuses type bindings and checks optional reads and nullable union boxes. It accepts lengths of dictionaries, bytes, sets and variable-length tuples stored in an integer-or-string union. More fixed-width integer operations run in runtime.py, and percent-format padding passes typed settings. (#1637, #1662, #1663, #1649, #1307, #1628, #1647)

Installation and limits

  • Run pystachy doctor to inspect the LLVM tools and runtime cache. pystachy --help prints the available commands. A pre-commit hook checks staged Python files with Pystachy. (#1640, #1646, #1645)
  • The Linux source-build workflow checks glibc 2.28 on x86-64. The LLVM 18 JIT keeps nested exception handlers on AlmaLinux 8. The distributed Linux archives still require glibc 2.39+ and LLVM 18. The macOS archives require macOS 15+, Xcode Command Line Tools and LLVM 20. (#1633, #1667, installation)
  • The compiler GC stress test retains the 7,000-allocation interval. The verifier's allocation cost and outstanding Lean report rejections remain tracked. (#1181, #1644, #1643)

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.7.0-alpha.2 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: 4998521d28413c6e32506105f836b6db9afeb1d7.

Pystachy v0.7.0-alpha.1

Pre-release

Choose a tag to compare

@github-actions github-actions released this 20 Nov 23:46
41dffd3

Pystachy v0.7.0-alpha.1 starts the v0.7.0 series from v0.6.1. It compiles nested and local classes, subclasses of list, dict and collections.abc classes, and classes with __getattr__; accepts an int where float is annotated; fills in most of enum; and makes the typed IR a checked text form with source locations. Pystachy remains an experimental compiler for a typed subset of Python.

Classes

  • A class statement in a class body, or in a function that runs at most once, makes a class with CPython's __qualname__. (#1596, #1613)
  • A class may derive from list, list[T], dict or dict[K, V] as its one base; what it leaves to the builtin compiles to the builtin's own code, __missing__ included. (#1558)
  • A class may derive from collections.abc classes such as MutableMapping, Sequence and Set, which inherit CPython's mixin methods, and isinstance() takes ABCs such as Sized, Iterable and Hashable. (#1610)
  • A class's __getattr__ is called for the attributes its objects lack, and a secondary base's __init__ may store attributes. (#1559, #1614)
  • Using a new object of an abstract class in the same expression, as print(Half()) does, raises CPython's TypeError, where the compiler failed. (#1621)

Typing and library

  • A variable, field or return annotated float holds an int it is given, as PEP 484 allows, and one annotated int or str holds an IntEnum, IntFlag or StrEnum member as it is. (#1550, #1592)
  • enum adds member(), nonmember(), @verify(...) with its checks, flags' boundary= (STRICT, CONFORM, KEEP), show_flag_values(), the global_*() helpers and the functional API at the top of a module. (#1563)
  • With dynamic Any, deque, bytearray, weakref.ref, MappingProxyType and the collections mappings compare with other types as CPython's do. (#1599)

Typed IR and tools

  • With PYSTACHY_IRCHECK=1, the typed IR verifier checks each operand against its value's type, and a value read at another type is an explicit cast op; the Lean shape check proves that each value is defined before it is read. Every op records its source line, and a module prints as text with its classes and their fields. (typed IR, #1593, #1566, #1604, #1606, #1617, #1625)
  • tools/annotate_ir.py shows each source line with its typed IR and LLVM IR, and tools/rejection_survey.py lists several rejections of a program in one run. (#1565, #1549)
  • The hosted compiler is checked under CPython 3.11 to 3.15, and 13 more pyperformance benchmarks are ported (38 of 52). (#1626, #1619)

Known limits and platforms

Dynamic Any and promoting integers remain experimental opt-ins. The known issues of v0.6.1 remain (#1512, #1513, #1514, #1602). The compatibility reference lists the limits of the new class features and the documented deviations.

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages. Prereleases leave the stable latest unchanged.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.7.0-alpha.1 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: 41dffd36201e6655c2603b28a458300c864237f7.

Pystachy v0.6.1

Choose a tag to compare

@github-actions github-actions released this 20 Nov 08:49
3751241

Pystachy v0.6.1 fixes bugs that v0.6.0 shipped with: wrong isinstance() answers for Any values, a collector crash and runaway memory, and strict encodes that passed invalid UTF-8. It adds no features. Pystachy remains an experimental compiler for a typed subset of Python.

Fixes

  • With dynamic Any, isinstance() accepts a NamedTuple object as a tuple, and a tuple of types that holds None raises CPython's TypeError. A local type that holds the builtin, such as a parameter type=type, still makes type(None) mean NoneType; any other is rejected at compile time. (#1581)
  • repr() of a set or frozenset that an element's __repr__ prints again gives set(...), where it raised RecursionError. (#1586)
  • A program that runs out of memory during a collection prints MemoryError, runs its atexit callbacks and exits with status 1, where it could die of SIGSEGV. (#1585)
  • A pyobj object whose __sizeof__ reports a size near 2**63 no longer stops collection for the rest of the run. (#1584)
  • A str read from a file with an overlong UTF-8 sequence counts each of its bytes as a character in encodes too, as len() does: a strict ASCII encode raises UnicodeEncodeError, where it returned the bytes. (#1587)
  • Decimal's //, % and divmod() take the time their operands' sizes need at any precision; at MAX_PREC they did not finish. (#1615)
  • bytearray(True) is one zero byte, where it was rejected, and boxing a set into Any is rejected with advice that compiles. (#1552, #1591)
  • With PYSTACHY_DEBUG_LINES=1, a loop's step, a with statement's file close and a function's shared raise block carry their own source lines. (#1562)

Known limits

Dynamic Any and promoting integers remain experimental opt-ins. The known issues of v0.6.0 remain, except isinstance() of Any values that hold NamedTuple objects: reads of a builtin's name where a module global of that name is unbound (#1512), star imports from a module that binds __all__ inside try or if (#1513), an except clause's as name that an import bound (#1514) and isinstance() tests against a second base class (#1602). The compatibility reference lists the documented deviations.

Platforms

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.6.1 for linux/amd64 and linux/arm64, with LLVM 18 included.

Source commit: 37512410e050da72b97b927f7d69830ed8377faa.

Pystachy v0.6.0

Choose a tag to compare

@github-actions github-actions released this 20 Nov 05:40
817c9cd

Pystachy v0.6.0 compiles more of the Python found in typed code such as mypy's: classes as values, objects beside numbers and strings in unions, more inferred field types, bytearray and more of the standard library. It also runs unittest suites natively and repairs results that v0.5.0 got wrong. Pystachy remains an experimental compiler for a typed subset of Python.

Classes, unions and generics

  • type[C] holds the class object of C or a subclass in variables, fields and containers. Class objects answer isinstance() and issubclass(), construct objects and call class and static methods; type[object] also holds builtin classes such as int. (alpha.2)
  • A union may hold int, float, bool or str beside objects of the program's classes, and runtime-length tuples hold objects. isinstance(), callable(), None and truth tests of x.a narrow the reads that follow.
  • A class may have several method-only secondary bases, such as mypyc traits, take type variables from its bases and derive from Iterator[...]. TypeVar takes bounds and constraints, and enum members may come from __new__ and run __init__.

Inference and the language

  • Fields take their types from more expressions, such as and and or operands, comprehensions, module globals and other classes' attributes. Annotations read Literal[...], TypeGuard, TypeIs, TYPE_CHECKING imports and NewType. (alpha.1)
  • An int argument may reach a float parameter of a function called directly. Its body computes with int operations, as CPython's does, under Pystachy's 64-bit integer limits. (#1533)
  • Sequence patterns match lists, with starred names. Subscripts, slices, range() and % formatting ask objects for __index__(), %(name)s formats a mapping, and dict keys() and items() views act as sets in in and comparisons.
  • bytearray supports indexing, slicing, slice assignment and its in-place methods; library functions still take bytes. (#1478)

Standard library

  • New: pprint, inspect.Signature, subprocess over fork and exec, importlib.resources, importlib.metadata, sysconfig, platform, base64 and gc. concurrent.futures runs a ThreadPoolExecutor on the program's one thread. (library reference)
  • functools.cached_property and total_ordering, contextlib.ExitStack and modules' __file__ are available. decimal adds exp(), ln(), log10() and Decimal powers, rounded as libmpdec rounds them, and str case methods follow CPython's Unicode rules. (limits)

Testing and performance

  • The native pytest runner runs unittest.TestCase classes, layered conftest.py files, marks, -k and -m, fixture scopes and parameters, tmp_path, capsys, capfd and monkeypatch. (#1287)
  • str case methods and character tests read generated Unicode tables, taking 0.3 to 1.9 times CPython's time on Russian, Chinese and French text (measurements). Float powers, rounding, %, // and comparisons of ints with floats run inline.
  • As opt-ins, PYSTACHY_JIT_OPT=2 runs LLVM's -O2 pipeline in the JIT, and PYSTACHY_PROFILE_GENERATE and PYSTACHY_PROFILE_USE optimize an executable by its profile. The PYSTACHY_UNICODE_AUDIT setting is removed.

Correctness repairs

Programs that v0.5.0 compiled now do what CPython does:

  • == and != between a value of a union of classes and an object compare the object, by its class's __eq__ or by identity, where v0.5.0 could print False for equal objects. (fix)
  • x += y through a value typed with a base class calls the in-place method of the object's subclass. Where the results have no common type, the program is rejected. (#1538)
  • A dict lookup whose key's __eq__ removes and stores its entry again finds it where it moved, where v0.5.0 could write outside the dict. (#1580)
  • On Linux AArch64, the collector scans the registers saved above main's frame, where a live object could be freed. (#1553)
  • Host paths such as sys.prefix keep their non-ASCII characters and undecodable bytes, and with dynamic Any, ranges answer isinstance() and == as CPython does. (#1517, #1523, #1595)

Known limits

Dynamic Any and promoting integers remain experimental opt-ins. Known issues include reads of a builtin's name where a module global of that name is unbound (#1512), star imports from a module that binds __all__ inside try or if (#1513), an except clause's as name that an import bound (#1514), isinstance() of Any values that hold NamedTuple objects (#1581) and isinstance() tests against a second base class (#1602). The compatibility reference lists the documented deviations.

Mapping patterns, async, full native mypy and broad concurrency remain outside v0.6.0.

Platforms

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.6.0 for linux/amd64 and linux/arm64, with LLVM 18 included.

Source commit: 817c9cd9e8a638232a65adb916af39735e503282.

Pystachy v0.6.0-rc.2

Pystachy v0.6.0-rc.2 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 20 Nov 03:19
299d12a

Pystachy v0.6.0-rc.2 is the last release candidate for v0.6.0. Since rc.1, it keeps the numeric defaults of fields typed as a union with a class under dynamic Any, finds a dict entry that a key's __eq__ moved instead of writing outside the dict, and answers isinstance() and == for ranges held as Any. Pystachy remains an experimental compiler for a typed subset of Python.

Corrections since rc.1

  • In a module that opts in to dynamic Any, a dataclass or NamedTuple field typed as a union with a class, as in y: int | P = 0, keeps its numeric default when a call leaves it out. Since alpha.2, which began to compile such unions, the field read None. (#1598)
  • A dict lookup whose key's __eq__ removes the entry it compares and stores the key again finds the entry where it moved, as CPython does. Previously d[k] = v wrote outside the dict there, and reads, in, del and pop answered wrongly. This predates the alphas. (#1580)
  • With dynamic Any, isinstance(x, range) is true for a range, and a range compared with a value of another type is unequal instead of raising AttributeError. (#1595)

Features carried from the alphas

  • Typing and fields: field and annotation types inferred in code like mypy's, sequence patterns on lists, and new standard library modules and functions. Alpha.1
  • Classes and unions: more of mypy's class and typing patterns, classes as values, objects beside numbers and strings in unions and runtime-length tuples, __index__ where CPython asks for it, and a wider decimal. Alpha.2
  • Library, types and speed: pprint, inspect, subprocess, importlib.resources, concurrent.futures, gc and bytearray; int arguments for float parameters; native unittest suites; faster string case methods and numeric paths; and a restructured typed IR. Alpha.3
  • Release candidate 1: in-place operators that call a subclass's method through a value typed with its base class, enum members whose __new__ annotates its return, and the undecodable bytes of host paths in __file__. rc.1

Known limits

Dynamic Any and promoting integers remain experimental opt-ins. Known issues that predate the alphas include reads of a builtin's name where a module global of that name is unbound (#1512), star imports from a module that binds __all__ inside try or if (#1513), an except clause's as name that an import bound (#1514), isinstance() of Any values that hold NamedTuple objects (#1581) and isinstance() tests against a second base class (#1602). The compatibility reference lists the documented deviations.

Mapping patterns, async, full native mypy and broad concurrency remain outside v0.6.0. Fixes found after this candidate ship in v0.6.0.

Platforms

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages. This prerelease keeps the stable defaults at v0.5.0.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.6.0-rc.2 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: 299d12ad5b2a4446088a5c0565fa25eb258c5a94.

Pystachy v0.6.0-rc.1

Pystachy v0.6.0-rc.1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 19 Nov 08:12
d35417c

Pystachy v0.6.0-rc.1 freezes the v0.6.0 feature set for final qualification. Since alpha.3, it calls a subclass's in-place operator method through a value typed with its base class, makes enum members whose __new__ annotates its return, and keeps the undecodable bytes of host paths in __file__. Pystachy remains an experimental compiler for a typed subset of Python.

Corrections since alpha.3

  • x += y and the other in-place operators call the in-place method of the object's class where a subclass defines one and the class that x is typed with does not, as CPython does, so other names for the object see the change. Previously the class's __add__ rebound x to a new object, also in the list and dict displays, conditional expressions and int | C unions that alpha.2 began to compile. Results with no common type are rejected. (#1538)
  • An enum class whose __new__ annotates its return, as in def __new__(cls, value) -> "Coord":, makes its members as CPython does. Alpha.2 and alpha.3 raised RuntimeError as each member was made. (#1555)
  • In a directory whose name is not valid UTF-8, the native compiler writes the name's bytes unchanged into __file__, importlib.metadata's search path and debug locations, as the hosted compiler does. Previously os.path.isfile(__file__) was false there. (#1523)
  • The language and library overviews list bytearray and alpha.3's modules as supported, and the documentation's test counts match the current corpus.

Features carried from the alphas

  • Typing and fields: field and annotation types inferred in code like mypy's, sequence patterns on lists, and new standard library modules and functions. Alpha.1
  • Classes and unions: more of mypy's class and typing patterns, classes as values, objects beside numbers and strings in unions and runtime-length tuples, __index__ where CPython asks for it, and a wider decimal. Alpha.2
  • Library, types and speed: pprint, inspect, subprocess, importlib.resources, concurrent.futures, gc and bytearray; int arguments for float parameters; native unittest suites; faster string case methods and numeric paths; and a restructured typed IR. Alpha.3

Known limits

Dynamic Any and promoting integers remain experimental opt-ins. Known issues that predate the alphas include reads of a builtin's name where a module global of that name is unbound (#1512), star imports from a module that binds __all__ inside try or if (#1513) and an except clause's as name that an import bound (#1514). The compatibility reference lists the documented deviations.

Mapping patterns, async, full native mypy and broad concurrency remain outside v0.6.0. Release candidates accept fixes within the frozen scope.

Platforms

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages. This prerelease keeps the stable defaults at v0.5.0.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.6.0-rc.1 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: d35417c967f25ac699bb713f4c796dfaf2c57fac.

Pystachy v0.6.0-alpha.3

Pre-release

Choose a tag to compare

@github-actions github-actions released this 18 Nov 19:49
8259611

Pystachy v0.6.0-alpha.3 is the last alpha of v0.6.0. It adds pprint, inspect, subprocess, importlib.resources, concurrent.futures, gc and bytearray, lets an int argument reach a float parameter, runs unittest suites natively, makes string case methods and numeric paths faster, and restructures the typed IR. Pystachy remains an experimental compiler for a typed subset of Python.

Standard library

  • pprint formats with every option CPython's has, choosing the layout by a value's static type; objects of classes print as their repr(). (#1344)
  • inspect gives Parameter, Signature and cleandoc(). subprocess gives run(), call(), check_call(), check_output(), getoutput() and Popen over fork and exec. importlib adds resources, util.resolve_name() and import_module() of a constant name. (#1417, #1385, #1365, #1474)
  • concurrent.futures runs a ThreadPoolExecutor on the program's one thread: submit() runs the call before it returns. gc.collect() runs the collector, and the module keeps its other settings. (#1416, #1351)
  • functools.total_ordering adds the ordering methods a class lacks, from the ones it defines or inherits, as CPython does. (#1473)
  • For mypy's own code, librt.base64 and ast_serialize, mypy's parser front end, give the results and errors of their C and Rust extensions. (#1434, #1435)

Language and types

  • bytearray is a class of the subset: mutable bytes with indexing, slicing, slice assignment and deletion, and the methods that change it in place. (#1478)
  • An int or bool argument may reach a float parameter of a function called directly, which compiles again for it. Its body computes with int operations, as CPython's does, under Pystachy's integer limits: a result past 64 bits raises OverflowError, and an int to a negative int power raises ValueError. (#1533)
  • % formats a mapping through %(name)s conversions, and in on a dict's keys() or items(), and comparisons of two such views, behave as sets. (#1479, #1256)
  • An optional import's handler runs where an imported module fails at its own import of a missing module, as ssl does without _ssl. (#1424)
  • Fields take their types from sets of one type and from other classes' attributes, tuple() takes sets and dicts, tab indentation follows CPython's tokenizer, and a dynamic-Any display may read a name that an earlier item's := binds. (#1388, #1405, #1343)

Testing

The native pytest runner runs unittest.TestCase classes, test packages with layered conftest.py files, marks, -k and -m, fixture scopes and parameters, tmp_path, capsys, capfd and monkeypatch. It reports a test it cannot compile and leaves it out. (#1287)

Performance

  • str's case methods and character tests read generated Unicode tables directly, taking 0.3 to 1.9 times CPython's time on Russian, Chinese and French text (measurements); the PYSTACHY_UNICODE_AUDIT setting is removed. (#1518)
  • Float powers, rounding, % and //, comparisons of ints with floats, bytes(list) and masked 32-bit integer arithmetic run inline, and larger objects take a free slot without a call. (#1436, #1449, #1437, #1441, #1447, #1445)
  • A range loop that indexes a list at a loop-invariant offset runs one checked test and then an unchecked loop that the Lean checker proves. (#1450, #1455)
  • As opt-ins, PYSTACHY_JIT_OPT=2 runs LLVM's -O2 pipeline in the JIT, and PYSTACHY_PROFILE_GENERATE and PYSTACHY_PROFILE_USE build an executable with a profile of its own runs. (#1456, #1444)

Compiler internals

The typed IR defines each operation in one table, closes its operand spellings, prints and parses as text, and has its shape proved in Lean. Frontend records leave the IR module, and layout reads lower to machine operations before LLVM. None of this changes a compiled program. (#1541 to #1545, #1284, #1285)

Correctness repairs

On Linux AArch64, the collector also scans the registers that main or an extension's entry saves above its frame record, where LLVM could keep a pointer across an allocation that the collector then freed. (#1553)

Known limits and platforms

Dynamic Any and promoting integers remain experimental opt-ins. Mapping patterns, async, full native mypy and broad concurrency are outside this alpha. x += y on a value typed as a class calls that class's __add__ even where the object's subclass defines __iadd__ (#1538). The compatibility reference lists the documented deviations.

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages. Prereleases leave the stable latest unchanged.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.6.0-alpha.3 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: 8259611ec88d5aa6af82d0098afb9dd621eb5617.

Pystachy v0.6.0-alpha.2

Pre-release

Choose a tag to compare

@github-actions github-actions released this 18 Nov 08:32
e2b97bb

Pystachy v0.6.0-alpha.2 continues the v0.6.0 series. It compiles more of the class and typing patterns in mypy's own code, uses classes as values, holds objects beside numbers and strings in unions and in runtime-length tuples, asks objects for __index__ where CPython does, and extends decimal. Pystachy remains an experimental compiler for a typed subset of Python.

Classes and generics

  • A class may name several method-only secondary bases: mypyc traits, generic bases, and bases that declare attributes by annotation, define @property getters or extend each other. An override may return a class derived from the one the base's method returns. (#1335, #1350, #1373, #1457, #1463)
  • A class is generic in the type variables its bases pass on and may derive from Iterator[...] or Iterable[...]. TypeVar takes bounds and constraints that are types, and objects of two sibling classes take their nearest common base. (#1352, #1391, #1346, #1243)
  • typing.final, mypy_extensions.trait and mypyc_attr(...) may decorate classes, and an alias of FlexibleAlias[T, X] stands for X, as in mypy. (#1275, #1342)
  • Enum members run the class's __init__; a __new__ in the documented form makes the members, and _simple_enum and global_enum work. (#1321, #1348)

Classes as values

type[C] holds the class object of C or of a subclass in variables, fields, defaults and containers. Class objects answer isinstance() and issubclass(), construct objects, and read the class attributes and call the class and static methods of the class they are. type[object], or type, holds any class's class object, including builtin classes such as int, and type(x) gives one; calling a type[object] value stays rejected. (#1315, #1361, #1372, #1406, #1407)

Unions, tuples and sets

  • A union may hold int, float, bool or str beside objects of the program's classes, dispatching operators and comparisons on the member it holds, and sum() adds objects in CPython's order. A union may also hold a Callable beside scalars and containers. (#1369, #1448)
  • isinstance(), callable(), None and truth tests of x.a narrow the reads that follow until the attribute may change. (#1453)
  • Runtime-length tuples hold objects of a class or of a union of classes, and tuples of other lengths join into them. (#1292, #1294, #1297)
  • AbstractSet[T] holds sets and frozensets. Frozensets hash as in CPython and serve as dict keys and set elements. (#1413, #1380)

Fields, globals and defaults

  • Fields take their types from module constants, annotated module globals and their items, and globals whose bindings agree on a type. (#1295, #1368, #1375)
  • A parameter whose default is an object() sentinel keeps its annotated type, and a read-only Sequence[T] = () default compiles as an empty list. if NAME: directly after NAME = True or NAME = False is decided when compiling. (#1362, #1390, #1338)
  • Type alias values and evaluated annotations raise CPython's AttributeError when they read a module attribute that a circular import has not bound yet. (#1399, #1400)

The index protocol

Subscripts, slices, range() and the integer parameters of list, tuple and str methods ask objects for __index__() and take an Any index, in CPython's order. In % formatting, %x, %o and %c ask for __index__(), and %d asks for __int__() first. (#1367, #1396, #1425)

Standard library and repairs

  • decimal adds sum() of Decimal values, exp(), ln(), log10() and powers with a Decimal exponent, correctly rounded as libmpdec computes them, and the remaining next_*, compare_* and *_mag operations. (#1370)
  • str methods map and test the case of non-ASCII text by CPython's per-character rules; bytes methods stay ASCII-only. (#1518)
  • librt.internal, mypy's cache codec, matches the C extension byte for byte. (#1276)
  • format() of a complex raises ValueError for a width or precision past sys.maxsize, as CPython does. (#1521)
  • math.prod() with a str or list start raises CPython's TypeError for a None item of a union of classes, where it crashed.

Known limits and platforms

Dynamic Any and promoting integers remain experimental opt-ins. Mapping patterns, async, full native mypy and broad concurrency are outside this alpha. The compatibility reference lists the documented deviations.

Native archive Requirements
Linux x86-64 / AArch64 Ubuntu 24.04 or compatible glibc 2.39+ Linux; LLVM 18
macOS arm64 / x86-64 macOS 15+, Xcode Command Line Tools; LLVM 20

Archives and Docker run without Python; the hosted compiler needs Python 3.11+ and reports commit unknown when installed with pip. Full verification targets Linux x86-64 and ARM64 with CPython 3.13.16. Linux archives are not manylinux packages. Prereleases leave the stable latest unchanged.

Release assets

Native compiler archives for Linux x86-64/AArch64 and macOS arm64/x86-64 are attached below, with their SHA-256 checksums in SHA256SUMS. They require LLVM 18 on Linux or LLVM 20 on macOS; see the installation instructions.

Docker image: dta67/pystachy:v0.6.0-alpha.2 for linux/amd64 and linux/arm64, with LLVM 18 included.

As a prerelease, this version does not move GitHub's latest release or Docker's latest tag.

Source commit: e2b97bb452ac2042a346e915eb9017f6e8f97328.