| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Pydantic V2 deprecated class-based model Config in favor of model_config = ConfigDict(...). Replace the inner Config class in RequestContext with the ConfigDict pattern to silence the deprecation warning emitted on import. Fixes aws#320
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #522 +/- ##
=======================================
Coverage ? 89.20%
=======================================
Files ? 96
Lines ? 8441
Branches ? 1256
=======================================
Hits ? 7530
Misses ? 586
Partials ? 325
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
|
Nice — this is the idiomatic V2 pattern and matches the existing model_config = ConfigDict(...) usage elsewhere in the repo (e.g. evaluation/runner/dataset_types.py). One suggestion to lock it in: add a regression test in tests/.../runtime/test_context.py that instantiates RequestContext under warnings.catch_warnings() + warnings.simplefilter("error") and asserts no PydanticDeprecatedSince20 warning is raised. That guards against the class-based Config silently creeping back in, and gives the fix a failing-before/passing-after anchor. Otherwise LGTM. |
Sorry, something went wrong.
…RequestContext
Instantiate RequestContext under warnings.simplefilter("error", PydanticDeprecatedSince20)
to ensure class-based Config never silently creeps back in.
Addresses review feedback from valter-silva-au on aws#522.
|
Thanks for the suggestion @valter-silva-au — added the regression test in a3175ec. It instantiates RequestContext under warnings.simplefilter("error", PydanticDeprecatedSince20) so any reintroduction of the class-based Config fails the suite. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
RequestContext in src/bedrock_agentcore/runtime/context.py uses the Pydantic V1-style inner class Config to set arbitrary_types_allowed = True. Pydantic V2 deprecated this pattern and emits a PydanticDeprecatedSince20 warning on every import of BedrockAgentCoreApp, adding noise to user applications and test suites.
Replace the inner Config class with model_config = ConfigDict(arbitrary_types_allowed=True) — the idiomatic Pydantic V2 pattern — so the warning is no longer emitted.
Fixes #320
Changes