Skip to content

Bump datamodel-code-generator from 0.57.0 to 0.64.0 - #3230

Open
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/uv/datamodel-code-generator-0.64.0
Open

Bump datamodel-code-generator from 0.57.0 to 0.64.0#3230
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/uv/datamodel-code-generator-0.64.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Jul 31, 2026

Copy link
Copy Markdown
Contributor

Bumps datamodel-code-generator from 0.57.0 to 0.64.0.

Release notes

Sourced from datamodel-code-generator's releases.

0.64.0

Breaking Changes

Code Generation Changes

  • Self-referencing fields are now quoted with --disable-future-imports - When --disable-future-imports is set (no from __future__ import annotations and no native PEP 649 deferred evaluation on Python < 3.14), self-referencing and forward-referencing field annotations in regular BaseModel classes are now emitted as quoted forward references instead of bare names. Previously such annotations were left unquoted, producing invalid code that raised NameError (Ruff F821) at class-evaluation time. Output for the common case (with from __future__ import annotations or Python 3.14 native deferred annotations) is unchanged. Users who snapshot/golden-file generated output for the --disable-future-imports configuration with self-referencing models will see the annotation change from unquoted to quoted, e.g. children: Optional[List[Node]]children: Optional[List["Node"]]. (#3387)

What's Changed

... (truncated)

Changelog

Sourced from datamodel-code-generator's changelog.

0.64.0 - 2026-06-14

Breaking Changes

Code Generation Changes

  • Self-referencing fields are now quoted with --disable-future-imports - When --disable-future-imports is set (no from __future__ import annotations and no native PEP 649 deferred evaluation on Python < 3.14), self-referencing and forward-referencing field annotations in regular BaseModel classes are now emitted as quoted forward references instead of bare names. Previously such annotations were left unquoted, producing invalid code that raised NameError (Ruff F821) at class-evaluation time. Output for the common case (with from __future__ import annotations or Python 3.14 native deferred annotations) is unchanged. Users who snapshot/golden-file generated output for the --disable-future-imports configuration with self-referencing models will see the annotation change from unquoted to quoted, e.g. children: Optional[List[Node]]children: Optional[List["Node"]]. (#3387)

What's Changed

... (truncated)

Commits

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    You can disable automated security fix PRs for this repo from the Security Alerts page.

Bumps [datamodel-code-generator](https://github.com/koxudaxi/datamodel-code-generator) from 0.57.0 to 0.64.0.
- [Release notes](https://github.com/koxudaxi/datamodel-code-generator/releases)
- [Changelog](https://github.com/koxudaxi/datamodel-code-generator/blob/main/CHANGELOG.md)
- [Commits](koxudaxi/datamodel-code-generator@0.57.0...0.64.0)

---
updated-dependencies:
- dependency-name: datamodel-code-generator
  dependency-version: 0.64.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code labels Jul 31, 2026
Comment thread pyproject.toml
"griffelib==2.1.0",
]
codegen = ["datamodel-code-generator==0.57.0"]
codegen = ["datamodel-code-generator==0.64.0"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Bumping datamodel-code-generator to 0.64.0 without regenerating the checked-in surface types breaks CI in two independent ways: the gen_surface_types.py --check drift gate fails for both src/mcp-types/mcp_types/_v2025_11_25/__init__.py and _v2026_07_28/__init__.py (0.64.0 emits new __pydantic_extra__/model_rebuild(force=True) blocks and changes JSONValue to RootModel[Optional[Union[...]]]), and even after regenerating, the new output violates the repo ruff config (7× UP006, 2× UP035, 2× UP045 — several not auto-fixable) while the per-file-ignores for _v*/__init__.py only cover D212/E501/I001/TID251/UP007/UP037, making the pre-commit lint hook and the byte-exact drift check mutually unsatisfiable. Fix: regenerate both surface packages in this PR and extend the _v*/__init__.py per-file-ignores with UP006/UP035/UP045 (or add a ruff check --fix pass to the generator script); the semantic JSONValue Optional change in the regenerated output also deserves review.

Extended reasoning...

What breaks

This PR bumps the codegen group pin from datamodel-code-generator==0.57.0 to ==0.64.0 (pyproject.toml + uv.lock) but does not regenerate the checked-in generated modules src/mcp-types/mcp_types/_v2025_11_25/__init__.py and src/mcp-types/mcp_types/_v2026_07_28/__init__.py. CI enforces byte-exact agreement between those files and fresh generator output: .github/workflows/shared.yml runs uv run --frozen --group codegen python scripts/gen_surface_types.py --check (the "Surface types match vendored schema" step). With 0.64.0 pinned, that check was reproduced at this PR's commit and exits 1 with drift in both files.

Why the output differs

datamodel-code-generator 0.64.0 changes its emitted code for this schema in three ways, none of which appear in the committed 0.57.0-generated files:

  1. For every extra='allow' class it appends X.__annotations__["__pydantic_extra__"] = Dict[str, Any] plus X.model_rebuild(force=True) — affecting GetTaskPayloadResult, Meta, Result, Data in _v2025_11_25 and InputSchema, OutputSchema, Result in _v2026_07_28.
  2. It adds Dict to the typing import to support those lines.
  3. JSONValue in _v2026_07_28 becomes class JSONValue(RootModel[Optional[Union[...]]]) — 0.64.0 emits Optional[...] here despite --use-union-operator. This is a semantic-looking change worth reviewing during regeneration, though the regenerated modules were verified to import and validate correctly at runtime (extras preserved on open classes, recursive JSONValue works).

Why regeneration alone still leaves CI red

Independently verified: after regenerating with 0.64.0, running the repo ruff config over the output at its real paths yields 11 errors, 8 auto-fixable — 7× UP006 (Dict[str, Any] instead of dict[str, Any]), 2× UP035 (deprecated typing.Dict import — not auto-fixable), and 2× UP045 on the new JSONValue Optional (the base-class occurrence is not auto-fixable). The per-file-ignores for src/mcp-types/mcp_types/_v*/__init__.py in pyproject.toml only cover D212, E501, I001, TID251, UP007, UP037 — none of the new codes.

This creates a deadlock between two CI gates. Pre-commit (run in CI on --all-files before the drift check) runs ruff check --fix --exit-non-zero-on-fix, so the 3 unfixable errors fail the hook outright and the 8 fixable ones trip --exit-non-zero-on-fix. But if you commit the --fixed files (Dictdict), they no longer byte-match fresh generator output, because scripts/gen_surface_types.py post-processes only with ruff format (around lines 255–260), never ruff check --fix — so the drift gate fails again. The committed files can satisfy the lint hook or the drift check, but not both, with the current config.

Step-by-step proof

  1. Check out this PR's commit; uv sync --group codegen --frozen installs datamodel-code-generator 0.64.0 (the new pin).
  2. Run the exact CI step: uv run --frozen --group codegen python scripts/gen_surface_types.py --check → exits 1, reporting drift in both _v2025_11_25/__init__.py and _v2026_07_28/__init__.py (new __pydantic_extra__ blocks, Dict import, JSONValue Optional).
  3. Run scripts/gen_surface_types.py (no --check) to regenerate, then ruff check with the repo config → 11 errors (7× UP006, 2× UP035, 2× UP045); UP035 and one UP045 are not auto-fixable, so pre-commit's ruff hook fails.
  4. Apply ruff check --fix and commit → step 2's drift gate fails again, since the generator pipeline never applies those fixes. No sequence of regenerate/fix steps makes both gates pass without a config or script change.

How to fix

In this PR: (a) run uv run --frozen --group codegen python scripts/gen_surface_types.py and commit the regenerated _v2025_11_25 and _v2026_07_28 packages (reviewing the JSONValue Optional change), and (b) either extend the src/mcp-types/mcp_types/_v*/__init__.py per-file-ignores with UP006, UP035, UP045 (matching the precedent of UP007/UP037, which exist for exactly this raw-codegen-output reason), or add a ruff check --fix pass to gen_surface_types.py's pipeline so generated output and lint-clean output coincide. This is a CI/tooling failure, not a runtime break — but without both changes the PR cannot merge.

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

Labels

dependencies Pull requests that update a dependency file python:uv Pull requests that update python:uv code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants