Skip to content

Commit c68bef4

Browse files
committed
Lazy load model data classes
1 parent 75f4134 commit c68bef4

93 files changed

Lines changed: 13618 additions & 46802 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,8 @@ jobs:
7373
- name: Run protocol tests
7474
run: |
7575
make generate-protocol-tests test-protocols
76+
77+
- name: Type-check protocol test stubs
78+
if: ${{ matrix.python-version == '3.12' }}
79+
run: |
80+
make typecheck-protocols

‎Makefile‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,20 @@ build-java: ## Builds and tests the Java code generation packages without modify
2424

2525
test-protocols: ## Generates and runs protocol tests for all supported protocols.
2626
cd codegen && ./gradlew :protocol-test:clean :protocol-test:build
27+
uv pip install -e packages/smithy-test
2728
@set -e; for projection_dir in codegen/protocol-test/build/smithyprojections/protocol-test/*/python-client-codegen; do \
2829
uv pip install "$$projection_dir"; \
2930
uv run pytest "$$projection_dir"; \
3031
done
3132

33+
# pyright's wrapper imports typing_extensions, which fails to import on 3.15
34+
# (removed typing.no_type_check_decorator); run the stub type-check on 3.12 only.
35+
typecheck-protocols: ## Type-checks the generated protocol-test stub fixtures with pyright.
36+
@set -e; for projection_dir in codegen/protocol-test/build/smithyprojections/protocol-test/*/python-client-codegen; do \
37+
uv pip install "$$projection_dir"; \
38+
uv run pyright "$$projection_dir/tests/_typecheck.py"; \
39+
done
40+
3241

3342
generate-protocol-tests: ## Generates protocol-test clients, copies them to ./codegen-output, and asserts no git diff.
3443
cd codegen && ./gradlew :protocol-test:clean :protocol-test:build

‎codegen-output/aws-json-1-0/pyproject.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ reportUnusedVariable = false
5353
reportUnnecessaryComparison = false
5454
reportUnusedClass = false
5555
enableExperimentalFeatures = true
56+
# models.py is the dynamic runtime; models.pyi carries the typed
57+
# surface for consumers, so don't type-check the implementation body.
58+
exclude = ["**/models.py"]
5659

5760
[tool.ruff]
5861
target-version = "py312"

0 commit comments

Comments
 (0)