Skip to content

chore: migrate Pydantic class-based Config to ConfigDict - #891

Open
MUKUL-PRASAD-SIGH wants to merge 1 commit into
kubeflow:mainfrom
MUKUL-PRASAD-SIGH:chore/pydantic-configdict
Open

MUKUL-PRASAD-SIGH wants to merge 1 commit into
kubeflow:mainfrom
MUKUL-PRASAD-SIGH:chore/pydantic-configdict

Conversation

@MUKUL-PRASAD-SIGH

@MUKUL-PRASAD-SIGH MUKUL-PRASAD-SIGH commented Oct 21, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it:

Pydantic v2 deprecated the class-based Config (PydanticDeprecatedSince20), and it will be removed in Pydantic v3. This PR migrates the three remaining usages in the package to model_config = ConfigDict(...):

  • kubeflow/common/types.py: KubernetesBackendConfig
  • kubeflow/trainer/backends/localprocess/types.py: LocalBackendStep, LocalBackendJobs

There is no behaviour change: each model keeps arbitrary_types_allowed=True.

These warnings are hidden in the test suite by the filterwarnings entry in pyproject.toml, but users importing the SDK still see them. After this change the package itself no longer emits PydanticDeprecatedSince20. I left the pyproject.toml filter untouched to keep this PR minimal.

Testing:

  • uv run pytest -W error::pydantic.warnings.PydanticDeprecatedSince20 kubeflow/common kubeflow/trainer/backends/localprocess: fails at collection on main, 37 passed with this change
  • uv run pytest ./kubeflow/: 697 passed
  • uv lock --check, ruff check, ruff format --check kubeflow, ty check kubeflow/hub (the make verify steps) and pre-commit on the changed files: all passing

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):

Fixes #890

Checklist:

  • Docs included if any changes are user facing (not user facing, no docs needed)

AI disclosure: Per the Kubeflow AI policy, this change was prepared with AI assistance (Claude Code) and reviewed and tested locally before submission.

Pydantic v2 deprecated the class-based `Config` (PydanticDeprecatedSince20)
and will remove it in Pydantic v3. Replace the three remaining usages in
KubernetesBackendConfig, LocalBackendStep and LocalBackendJobs with
`model_config = ConfigDict(arbitrary_types_allowed=True)`.

No behaviour change: each model keeps arbitrary_types_allowed=True.

Signed-off-by: MUKUL PRASAD <mukulprasad958@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CqSS2VmaiPUMZ8AN2rBwLp
@MUKUL-PRASAD-SIGH

Copy link
Copy Markdown
Author

/assign @andreyvelich
/cc @szaher

@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign astefanutti for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Ready to Merge

Development

Successfully merging this pull request may close these issues.

Migrate deprecated Pydantic class-based Config to ConfigDict

2 participants