Skip to content

Commit 9be5c97

Browse files
lesnik512claude
andcommitted
docs(engineering): fix grep regex for guarded extra imports
The previous regex anchored `^from pydantic` matched zero lines because the imports now live inside `if import_checker.is_pydantic_installed:` blocks (i.e., indented). Update the example command to match indented import lines and filter out the import_checker module itself. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 948c485 commit 9be5c97

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

planning/engineering.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ msgspec = ["msgspec>=0.18"]
103103
otel = ["opentelemetry-api>=1.20", "opentelemetry-sdk>=1.20"]
104104
```
105105

106-
Each extra's code lives in a single dedicated module (`decoders/pydantic.py`, `decoders/msgspec.py`, `middleware/observability/otel.py` when Epic 5 lands). The `import` of the extra happens **inside** that module behind an `is_<extra>_installed` guard from `_internal/import_checker.py` — never at package top level. This way, `import httpware` works cleanly without the extras installed, and the seam stays observable: `grep -rE '^from pydantic|^import pydantic' src/httpware/` returns exactly one file (the guarded import in `decoders/pydantic.py`), and the same is true for `msgspec`.
106+
Each extra's code lives in a single dedicated module (`decoders/pydantic.py`, `decoders/msgspec.py`, `middleware/observability/otel.py` when Epic 5 lands). The `import` of the extra happens **inside** that module behind an `is_<extra>_installed` guard from `_internal/import_checker.py` — never at package top level. This way, `import httpware` works cleanly without the extras installed, and the seam stays observable: `grep -rnE 'from pydantic|import pydantic' src/httpware/ | grep -v import_checker` returns exactly one indented line (the guarded import in `decoders/pydantic.py`), and the same is true for `msgspec`.
107107

108108
Caller-facing pattern: consumers select the implementation by passing it explicitly, e.g., `AsyncClient(decoder=PydanticDecoder())`. There is no auto-detection or implicit registry.
109109

0 commit comments

Comments
 (0)