Skip to content

Commit 0223863

Browse files
lesnik512claude
andcommitted
feat(story-1.6): _internal/import_checker.py for find_spec-based extra detection
Adds is_msgspec_installed flag computed once at module import time via importlib.util.find_spec. No actual import of msgspec happens — only the importlib check. Future opt-in extras (otel in Story 5-4, etc.) extend this module with their own flags. Pattern adapted from modern-python/lite-bootstrap. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b12a989 commit 0223863

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"""Detect optional extras without importing them. Used by adapter modules to gate hard imports."""
2+
3+
from importlib.util import find_spec
4+
5+
6+
is_msgspec_installed = find_spec("msgspec") is not None

0 commit comments

Comments
 (0)