Skip to content

fix: genuinely zero-dependency core (drop runtime typing_extensions)#158

Merged
lesnik512 merged 1 commit into
mainfrom
fix-typing-extensions-1.3.1
Jul 19, 2026
Merged

fix: genuinely zero-dependency core (drop runtime typing_extensions)#158
lesnik512 merged 1 commit into
mainfrom
fix-typing-extensions-1.3.1

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

A clean-room install of the published 1.3.0 on a fresh 3.14t venv found that bare pip install lite-bootstrap + import lite_bootstrap (no extras) crashes:

ModuleNotFoundError: No module named 'typing_extensions'

Core uses typing_extensions at runtime but never declared it: a Self return annotation in instruments/base.py and a TypedDict base class in instruments/healthchecks_instrument.py. Pre-existing (bare 1.2.3 fails identically — its only core dep was orjson, which also doesn't pull typing_extensions); every install with any extra masked it, because extras pull typing_extensions in transitively. So 1.3.0's "zero-dependency core" claim was false.

Fix (keeps dependencies = [] — truly zero-dep)

  • base.py: from __future__ import annotations + TYPE_CHECKING-guarded typing_extensions import (the Self annotations become lazy; nothing resolves them at runtime — no get_type_hints anywhere).
  • healthchecks_instrument.py: typing_extensions.TypedDicttyping.TypedDict (in stdlib since 3.8; project requires ≥3.10; plain total=False, no Required/NotRequired).

Rejected declaring typing-extensions as a dep: removing the usage instead makes the zero-dependency promise actually true.

Testing

  • Clean-room bare install on 3.14t with no typing_extensions present: import lite_bootstrap + FreeBootstrapper.bootstrap()/teardown() + HealthChecksConfig.health_check_data all succeed.
  • typing.TypedDict verified on real 3.10.20; the pytest matrix (3.10–3.14) re-confirms.
  • just test 215 passed, 100% coverage; just lint-ci clean (ty resolves the lazy Self).

Ships as 1.3.1 (patch) — see planning/releases/1.3.1.md.

🤖 Generated with Claude Code

Bare `pip install lite-bootstrap` + `import lite_bootstrap` (no extras) crashed
on undeclared typing_extensions: base.py uses `typing_extensions.Self` and
healthchecks_instrument.py's TypedDict is a FastAPI response model that pydantic
requires be a `typing_extensions.TypedDict` on Python < 3.12 (stdlib
typing.TypedDict is rejected there). So genuine zero-dependency core is not
achievable while supporting 3.10/3.11 — declare typing-extensions (pure Python,
free-threaded-friendly). Pre-existing (bare 1.2.3 failed identically); surfaced
by a clean-room 3.14t install of published 1.3.0. Ships as 1.3.1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lesnik512
lesnik512 force-pushed the fix-typing-extensions-1.3.1 branch from 21aa0fa to 649f045 Compare July 19, 2026 14:08
@lesnik512
lesnik512 merged commit 65845e0 into main Jul 19, 2026
10 checks passed
@lesnik512
lesnik512 deleted the fix-typing-extensions-1.3.1 branch July 19, 2026 14:10
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