Repository navigation
Lazy load model data classes - #851
Merged
Merged
Conversation
kuhe
force-pushed
the
kuhe/chore/models
branch
6 times, most recently
from
October 15, 2026 17:15
e403e39 to
1578269
Compare
Contributor
Author
|
4% serde slowdown after cold start, but we'll reclaim that performance in another PR. The SDK has to start up without going OOM first. |
kuhe
marked this pull request as ready for review
October 15, 2026 18:50
kuhe
force-pushed
the
kuhe/chore/models
branch
3 times, most recently
from
October 15, 2026 21:14
c68bef4 to
987e77b
Compare
stobrien89
requested changes
Oct 15, 2026
| if scalar is not None: | ||
| return scalar | ||
| if st == ShapeType.STRUCTURE: | ||
| target = member.expect_member_target().id.name |
Contributor
There was a problem hiding this comment.
Do we lose the namespace here?
Contributor
Author
There was a problem hiding this comment.
smithy model validation currently guarantees service closure uniqueness in the short names being used here.
I want to make that fix in a different PR if/when needed.
kuhe
force-pushed
the
kuhe/chore/models
branch
4 times, most recently
from
October 17, 2026 18:30
aaf2366 to
6c16a24
Compare
stobrien89
requested changes
Oct 19, 2026
kuhe
added a commit
that referenced
this pull request
Oct 19, 2026
…rename detection Addresses review comments on PR #851: - Deserialize enum members through the built enum class instead of returning the raw str/int. - Set __module__ on union parent, variants, and Unknown so they report the client models module. - Guard build() with an RLock so concurrent builders of one shape cannot publish two class objects. - Read the enum class name from ENUM_SYMBOL in ModelModuleGenerator so renamed enums index correctly and no bogus str/int rename entries are emitted.
…rename detection Addresses review comments on PR #851: - Deserialize enum members through the built enum class instead of returning the raw str/int. - Set __module__ on union parent, variants, and Unknown so they report the client models module. - Guard build() with an RLock so concurrent builders of one shape cannot publish two class objects. - Read the enum class name from ENUM_SYMBOL in ModelModuleGenerator so renamed enums index correctly and no bogus str/int rename entries are emitted.
Constructing the APIOperation table builds no model classes and hydrates no schemas; using one operation builds only that operation's input, not sibling operations' shapes or every schema in the module.
kuhe
force-pushed
the
kuhe/chore/models
branch
from
October 19, 2026 16:52
e28e988 to
ab3271d
Compare
stobrien89
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@dataclassannotations in the models.py file take up too much CPU time on initialization. As things stand, a 128mb lambda would OOM just by loading a handful of AWS SDK clients, if they are any of the somewhat large ones (not necessarily even to EC2's level).To avoid this, the PR:
models.pyideclare the classes as type interfaces onlymodels.pygenerate the classes on-demandCold-start benchmark
AWS Lambda w/ 512 MB, Python 3.12
Imports (does not instantiate) 5 generated clients at module scope: bedrock-agentcore-control, bedrock, guardduty, bedrock-agent, lambda.
Init Duration, median of 3 cold starts.