SPy: An interpreter and compiler for a fast statically typed variant of Python

Site & Cookie Experience

  • Several readers couldn’t view the article on mobile without accepting a cookie banner, found the UX confusing, and questioned GDPR compliance (e.g., pre-checked boxes).
  • Others reported that browser extensions blocking cookie popups removed the notice entirely.

Goal: Fast, Statically Typed “Python-like” Language

  • Many people like the idea of a compiled, statically typed language that keeps Python’s readability and “pseudocode that runs” ethos.
  • There’s optimism that SPy could be used for performance‑critical modules alongside regular Python, e.g., .spy for hot paths imported into CPython.

Comparisons to Existing Tools and Languages

  • Nim is repeatedly cited as “Python‑ish but compiled,” with praise for the language and complaints about ecosystem brittleness and missing Python‑level libraries/web frameworks.
  • F#, Crystal, Cython, RPython, Mojo, Shedskin, ChocoPy, MicroPython, and earlier “Viper” projects are all mentioned as prior or parallel attempts at similar goals.
  • Cython is seen by some as mature and practical, by others as syntactically awkward and “worst of both worlds” (harder than Go yet not that fast).
  • Several comments say SPy feels closer to a Cython replacement / systems companion to Python than a full Python replacement.

Python Ecosystem, Typing, and Subsets

  • Strong consensus that Python’s main strength is its huge ecosystem; this is tied to dynamic/duck typing and ease of getting started.
  • Concern: any non‑100%‑compatible subset will constantly hit missing features or incompatible libraries, leading to “loss aversion” versus a clean new language.
  • Example references: cperl required adding types to ~10% of modules; people expect “will it support NumPy / Django / FastAPI?” from any Python subset.
  • Debate over type hints: some say types should be enforced “contracts,” others note that in Python they’re only hints; there’s frustration that violating annotations yields no errors by default.

Design Concepts: Red/Blue, Redshifting, Comptime

  • SPy’s “blue” (compile‑time) vs “red” (runtime) expressions and “redshifting” are broadly recognized as a partial evaluation / compile‑time evaluation scheme.
  • Some like the comptime‑style power (Zig/Forth comparisons); others dislike the bespoke terminology and @blue name, preferring established terms like @comptime / @consteval and “constant folding/propagation.”
  • The author explains colors are inherited from earlier work, changed to be colorblind‑friendly, and useful for tooling (spy --colorize).

Dynamic Languages and Performance Context

  • Discussion branches into how Common Lisp, Smalltalk, SELF, and Julia handle extreme dynamism with sophisticated JITs, and how CPython’s C API blocks many similar optimizations.
  • Ruby and Python are both cited as languages where many “worst‑case” dynamic features exist but are rarely used in real code; ideas include freezing core classes or disallowing monkey‑patching in certain modules to enable static optimization.

Interoperability and Architecture

  • The author clarifies that SPy will call Python libraries via an embedded libpython with an interop layer, letting CPython handle imports while converting/proxying objects.
  • Commenters see value in using SPy from CPython as a fast implementation language for libraries, in line with the common “systems language + scripting language” architecture.

Reception and Open Questions

  • Enthusiasm: people call the project “super cool,” “promising,” and closer to what they had hoped Mojo would be; they like the clear articulation of Python’s “dynamic vs fast” trade-offs.
  • Skepticism: fears that statically typed Python subsets inevitably become “Java with Python syntax,” or that constructing yet another partial Python implementation is a “fool’s errand” versus adopting Nim/Rust outright.
  • Some want to see more idiomatic “Pythonic” code (lists, comprehensions, generators, dicts/sets) compiled 30–100× faster to be convinced.
  • There is interest in future details on generics, static dispatch, WASM vs native targets, and how well SPy will handle complex, dynamic library patterns (e.g., ORMs, Django‑style magic).