← Back to issue list

chore(lint): get around a Pydantic 2.10.x type bug

View original Github issue

Metadata

Project
craft-application
Number
#566
Type
pull request
State
merged
Author
tigarmo
Labels
—
Created
Updated
Closed

Current evaluation

Merged #566, adding a targeted type-ignore for a false-positive Pydantic 2.10.x default_factory error; change landed in commit 5a05290a.

Resolution: closed resolved

Reason: PR #566 was approved and merged, bypassing the known Pydantic typing bug while preserving runtime behavior. The change is recorded in commit 5a05290a.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Both mypy and pyright complain that the "field.default_factory()" call has too few arguments, even though its type is typing.Callable[[], Any]. It should be fixed soon, and in the meantime we can ignore the spurious error. Ref: https://github.com/pydantic/pydantic/issues/10945 - [ ] Have you followed the guidelines for contributing? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `tox`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #566, adding a targeted type-ignore for a false-positive Pydantic 2.10.x default_factory error; change landed in commit 5a05290a.
stealth/space-bunny-alpha — closed resolved Merged PR #566 added a lint suppression for false-positive mypy/pyright errors on Pydantic 2.10.x field.default_factory() calls; reviewers approved it with no unresolved comments.
qwen/qwen3.6-35b-a3b — — Merged a linting workaround to suppress spurious type-checking errors in mypy and pyright regarding Pydantic 2.10.x's field.default_factory(). The upstream bug will not be fixed, but the suppression approach was approved and merged.

Update history

No update history recorded yet.

Related work

  • Related To: pydantic#10945 (confidence 99%)

    Upstream Pydantic typing issue that prompted the workaround.

Related issues

Issue Project State Summary Similarity
#238 chore(lint): get around pydantic 2.10.x bugs craft-store merged Merged in #238 as commit d1eb379, adding lint and test workarounds for Pydantic 2.10.x false positives and pydantic_core URL-comparison breakage.
85%
#4406 chore: ignore types snapcraft merged Merged PR #4406 as feb701d30, suppressing pkg_resources type errors from pyright 1.1.332 and unblocking PEP 518 support in #4087.
73%
#35 chore: fix pydantic deprecation craft-grammar merged Merged PR #35 (commit 6be0fc3) updated custom type validation to address Pydantic 2's deprecated __get_validators__ hook.
72%
#181 chore(lint): add new typing dependencies and fix pyright issues craft-cli merged PR #181 merged into main as commit d34fdd6 (Sep 2023): added typing stub dependencies and fixed the resulting Pyright errors, a 1-file, +6/-1 lint/tooling change.
71%
#122 chore: eliminate pydantic warnings craft-archives merged Merged PR #122 eliminated Pydantic warnings, landing as commit 00b9b3b after approval by two reviewers.
70%