Skip to content

fix(service): preserve slotted service subclasses with compiled core runtime - #785

Merged
cofin merged 8 commits into
mainfrom
fix/svc-stuff
Sep 15, 2026
Merged

cofin merged 8 commits into
mainfrom
fix/svc-stuff

Conversation

@cofin

@cofin cofin commented Sep 14, 2026

Copy link
Copy Markdown
Member

Summary

Keep SQLSpecAsyncService and SQLSpecSyncService as ordinary slotted Python classes in sqlspec.service._base while retaining compiled query execution and transaction helpers in the private sqlspec.service._core runtime. Downstream consumers and frameworks (such as Litestar and Advanced Alchemy) preserve generic typing and __slots__ without native class layout restrictions or slotscheck exclusions.

Changes

  • Service Architecture (sqlspec/service/):
    • Organized sqlspec/service into a package with explicit re-exports in __init__.py.
    • Moved service bases to sqlspec/service/_base.py as pure slotted Python classes (excluded from mypyc compilation).
    • Moved core query execution and transaction management into sqlspec/service/_core.py (compiled via hatch-mypyc).
  • Driver & Base Classes:
    • Maintained native extension classes for driver connection contexts, session factories, and exception handlers across sqlspec/driver/.
  • Tooling & CI:
    • Added compiled-wheel smoke test suite (tools/scripts/mypyc_smoke.py and tools/scripts/mypyc_inventory.py) testing multi-level slotted subclasses, transaction contexts, and session acquisition.

@codecov-commenter

codecov-commenter commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.03546% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.93%. Comparing base (47ed4b7) to head (b49b288).

Files with missing lines Patch % Lines
sqlspec/service/_core.py 94.81% 9 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #785      +/-   ##
==========================================
- Coverage   78.93%   78.93%   -0.01%     
==========================================
  Files         491      493       +2     
  Lines       72316    72337      +21     
  Branches    10165    10165              
==========================================
+ Hits        57081    57096      +15     
- Misses      11730    11736       +6     
  Partials     3505     3505              
Flag Coverage Δ
integration 62.44% <75.17%> (+<0.01%) ⬆️
py3.10 77.06% <95.03%> (+<0.01%) ⬆️
py3.11 77.06% <95.03%> (-0.01%) ⬇️
py3.12 77.07% <95.03%> (+<0.01%) ⬆️
py3.13 77.06% <95.03%> (+<0.01%) ⬆️
py3.14 78.20% <95.03%> (+<0.01%) ⬆️
unit 67.28% <95.03%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sqlspec/service/__init__.py 100.00% <100.00%> (ø)
sqlspec/service/_base.py 96.82% <100.00%> (ø)
sqlspec/service/_core.py 94.81% <94.81%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cofin cofin changed the title fix(service): add native_class=False to service @mypyc_attr decorators (#785) fix(core): allow interpreted subclassing for service, driver, and filter base classes Sep 15, 2026
@cofin cofin changed the title fix(core): allow interpreted subclassing for service, driver, and filter base classes fix(core): allow interpreted subclassing for service, connection context, and exception handler classes Sep 15, 2026
@cofin cofin changed the title fix(core): allow interpreted subclassing for service, connection context, and exception handler classes fix: preserve slotted service subclasses with compiled helpers Sep 15, 2026
@cofin cofin changed the title fix: preserve slotted service subclasses with compiled helpers fix(service): preserve slotted service subclasses with compiled core runtime Sep 15, 2026
@cofin
cofin merged commit 3e984f5 into main Sep 15, 2026
29 checks passed
@cofin
cofin deleted the fix/svc-stuff branch September 15, 2026 18:18
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.

2 participants