Repository navigation
partition schemas and model stubs - #871
stobrien89 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Generated-output compatibility and lint failures remain, alongside schema-planning and partition-weighting issues that undermine scalability.
4 open issues
What changed in this PR
This PR extends the native standalone types generator with private schema and model-stub partitions, reducing memory use and static analysis time while retaining stable facade modules.
Changes:
- Adds configurable partition targets, defaulting to 250 items.
- Balances schema partitions by estimated source size and keeps recursive components together.
- Adds partitioning tests and documents output layout, compatibility, and benchmark results.
| File | Description |
|---|---|
| packages/smithy-python/tests/unit/test_schemas.py | Tests thresholds, lazy loading, recursion, and size balancing. |
| packages/smithy-python/tests/unit/test_models.py | Tests partitioned stubs, public models, and strict Pyright. |
| packages/smithy-python/tests/unit/test_generation.py | Tests partition defaults and positive-value validation. |
| packages/smithy-python/src/smithy_python/schemas.py | Adds weighted schema partitions and a lazy facade. |
| packages/smithy-python/src/smithy_python/models.py | Adds private stub partitions and public re-exports. |
| packages/smithy-python/src/smithy_python/generation.py | Defines and validates partition settings. |
| designs/codegen/types.md | Updates settings and large-model design guidance. |
| designs/codegen/partitioning.md | Documents partitioning behavior and performance measurements. |
| designs/codegen/index.md | Links the partitioning design. |
Review effort: Balanced
818584f to
91cc4c3
Compare
91cc4c3 to
feb5bec
Compare
|
is first model access added time paid every partition that's touched for the first time? also, what is happening in the additional 10ms? |
feb5bec to
f31e94c
Compare
71f66df to
fe17013
Compare
fe17013 to
0b82f1f
Compare
yeah, there’s a one-time cost when each schema partition is first touched, but it’s not 10 ms per partition That 10 ms is mostly work moved out of the initial import. Import plus first access stayed basically the same at 62.9 ms unpartitioned versus 62.7 ms partitioned. After that, the loaded partitions and schemas are cached. |
0b82f1f to
ca23f2f
Compare

Issue #, if available:
#797
Description
Partitions large standalone types packages to reduce generation memory and static analysis time.
Stacked on #866 and intended to be reviewed against
native-types-cli-integration.Changes
schemas.pyandmodels.pyifacades.EC2 benchmark
Measured on x86 with 4,065 selected shapes, five runs, and one warmup.
Validation
Compatibility
Public model imports, lazy model construction, schema identity, serde behavior, and typing remain unchanged. Partition files live under
_private.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.