Skip to content

refactor: remove Python parity scaffolding from the native compiler - #1087

Merged
kvlonge merged 9 commits into
mainfrom
refactor/remove-python-parity-shims
Oct 12, 2026
Merged

kvlonge merged 9 commits into
mainfrom
refactor/remove-python-parity-shims

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Why

The compiler is now native Rust and Python byte-for-byte parity is no longer a goal. The remaining parity scaffolding (engine switch, fallback counters, Python Unicode tables, a PyYAML 1.1 imitation and copies of Python text helpers) adds code and test surface without product value. The temporary 0.156.0 release memory exceptions are also due for removal.

Changes

  • Use Rust's standard Unicode, whitespace, trimming and line-splitting rules instead of per-Python tables and copies.
  • Remove --compiler-engine, SQLBUILD_COMPILER_ENGINE, native fallback counting and engine comparison; the compiler differential checks each corpus project once against stored goldens.
  • Read YAML as YAML 1.2 with the core schema plus merge keys (yes/no/on/off and dates are text, 017 is 17, tabs and %YAML directives load); docs updated.
  • Replace the difflib and fnmatch ports with an edit-distance suggester and a small wildcard matcher; replace the Python-regex wrapper with standard classes.
  • Reject non-numeric !!int values; drop CI references to deleted tests.
  • Remove the 0.156.0 release memory exceptions and set the 3,000-model lineage cap to 144 MiB (measured peak about 131 MiB).
  • Ship LICENSE at the root of the sqlbuild-cli sdist; PyPI rejected the 0.156.0 CLI sdist because its License-File was missing.

Verification

  • make compiler-differential with stage captures and coverage gates: 368 projects as expected.
  • make test: 11,553 passed. make check-ci passes.
  • Built the CLI sdist locally: twine check passes and it installs sqb.
  • Private compile-only check of a large real project and a dense 1,000-model project: identical compiled output.

Native text helpers no longer carry Python's per-version Unicode tables or
need the Python and Unicode versions passed through every binding. Letter,
case and repr checks use Rust's Unicode rules; decimal digits keep a small
Nd table so non-ASCII digit diagnostics and values are unchanged. Removes the
D017 unsupported-Python error, the table generator and parity oracles that
only pinned the tables.
The native compiler is the only compiler, so the native-preview engine, the
--compiler-engine flag and SQLBUILD_COMPILER_ENGINE, the stage tiers, the
fallback and analysis-deferral recorders and the Polyglot site recorder go.
The compiler differential runs each corpus project once and checks it against
its expectation and golden; the native fallback allow-list is removed.
@kvlonge
kvlonge enabled auto-merge (squash) October 12, 2026 05:04
@kvlonge
kvlonge merged commit 714e6f2 into main Oct 12, 2026
43 of 44 checks passed
@kvlonge
kvlonge deleted the refactor/remove-python-parity-shims branch October 12, 2026 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant