Repository navigation
fix(train): bound pydantic to <3.0.0 for cross-package consistency - #6363
Conversation
sagemaker-train declared pydantic>=2.0.0 with no upper bound, while sagemaker-core declares pydantic>=2.0.0,<3.0.0. Installing sagemaker-train on its own could therefore resolve a different pydantic major than the rest of the SDK allows. Align the bound so all sub-packages agree on the pydantic major, letting pip resolve a single consistent pydantic (and its matching, pydantic-managed pydantic-core). Note: pydantic-core is intentionally not pinned; pydantic pins its own exact pydantic-core, and pinning it here would fight that mechanism. Relates-to aws#5652
|
Claude finished @rsareddy0329's task in 33s —— View job PR Review: bound
|
There was a problem hiding this comment.
🤖 AI code review
This PR bounds the pydantic runtime dependency in sagemaker-train/pyproject.toml to >=2.0.0,<3.0.0, matching the constraint already declared in sagemaker-core. I verified the two packages now agree on the pydantic major, and that pydantic-core is correctly left unpinned per the established approach (pydantic manages its own pydantic-core). The change is correct, minimal, and consistent with team precedent (Source: #5728). No issues found.
Reviewed commit cbbffd3. Automated review; verify before acting.
Issue #, if available: Relates to #5652
Description of changes:
sagemaker-traindeclaredpydantic>=2.0.0with no upper bound, whilesagemaker-coredeclarespydantic>=2.0.0,<3.0.0. Installingsagemaker-trainon its own could therefore resolve a different
pydanticmajor than the rest ofthe SDK allows. This aligns the bound so all sub-packages agree on the
pydanticmajor, letting pip resolve a single consistent
pydantic(and its matching,pydantic-managed
pydantic-core).pydantic-coreis intentionally not pinned:pydanticpins its own exactpydantic-core, so pinning it here would fight that mechanism and cause moreconflicts, not fewer.
Scope note re #5652: the
SystemError: The installed pydantic-core version ... is incompatible with the current pydantic versionreported there comes fromupgrading
pydantic-coreindependently ofpydantic(e.g.pip install ... pydantic-core --force-reinstall --no-deps), which no dependencydeclaration can prevent. This change is the dependency-hygiene half of the fix —
it removes the version-skew gap between the sub-packages so a normal install lands
a consistent pair. Users who hit the mismatch after a manual
pydantic-coreupgrade should realign with
pip install --force-reinstall "pydantic>=2,<3".Testing:
sagemaker-train/pyproject.tomlparses and the productionpydanticconstraintnow matches
sagemaker-core(pydantic>=2.0.0,<3.0.0). Metadata-only change; noruntime code affected.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.