Skip to content

refactor: move the shared core of the Python bindings into sqlbuild-python-base - #1505

Merged
kvlonge merged 2 commits into
mainfrom
refactor/python-base-crate
Nov 15, 2026
Merged

kvlonge merged 2 commits into
mainfrom
refactor/python-base-crate

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Why

sqlbuild-python is far above the crate size limit and its helper buckets depend on each other, so it can only be split bottom-up along the XSB075 layers. This first slice moves the core every binding uses into its own crate.

Changes

  • New PyO3 crate sqlbuild-python-base (about 11.8k code lines): native record, enum and error classes (specs, registration, construction, field reads); keyword calls, imports, conversions, panics; host entry calls; positional traits and macros; the allocator. Its public surface is main/ entries and role files.
  • sqlbuild-python imports from the base directly, with no shims; a script rewrote the imports. It keeps the getter tables and record behaviours and passes them to register_records, so registration order is unchanged.
  • python-boundary lists both binding crates; the native-layering check, XSB072/XSB073 roots and module-path scan cover both. Moved files keep their XSB072/XSB073 budgets and edges.
  • The rewrite touches 14 duplicate clusters that already exist on main. The one exact copy, session_warehouse_support, is merged; the rest are listed in [dupes] with reasons.
  • Caps lowered: bindings crate 217,836 → 206,335 code lines, helpers container 111 → 101 buckets.

No DuckShop case applies: only where the binding code lives changes.

Verification

  • dir(sqlbuild._native) surface (types, signatures, docs, MRO, order) is unchanged.
  • Dense 3,000-model compile, base and candidate alternating on one machine: compile JSON identical. Medians of 3, load 1.7–2.7 on 8 cores: wall 9.29 → 9.71 s, CPU 29.36 → 27.98 s (10 earlier runs: 9.03 → 8.76 s). Neutral.
  • Incremental rebuild after a one-file edit in sqlbuild-python (--profile fast, load 5.6–8): wall 46–48 → 43–47 s, CPU 189–197 → 177–185 s.
  • fensu check, check-native-layering, check-native-stub, check-build-features, clippy -D warnings, the layering, module path and fensu policy script tests, make test and make check-ci pass.

…ython-base

The native record, enum and error classes, the Python call plumbing, the
host entry calls and the process allocator move into a new PyO3 crate that
every later binding crate can depend on. sqlbuild-python imports them
directly; the extension module surface is unchanged.
@kvlonge
kvlonge enabled auto-merge November 15, 2026 17:09
@kvlonge
kvlonge added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 6877100 Nov 15, 2026
33 checks passed
@kvlonge
kvlonge deleted the refactor/python-base-crate branch November 15, 2026 19:24
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