pydantic/pydantic

14 rules learned from 1,000 merged PRs: the files and habits in pydantic/pydantic that kept needing a fix after merge.

Merged PRs read
1,000
Needed a fix
38 (3.8%)
Reverted
9
Merged between
2025-02-02 and 2026-11-09

Tested on new PRs: it didn't hold here

1 of the 45 code PRs that breached a rule needed a fix (2%), against 4 of the 29 that breached none (14%). PRs that breached a rule did not clearly need a fix more often, so the rules did not hold here.

Rules were learned from older PRs, then tested on later PRs they hadn't seen. How we tested

Fix-prone files and folders

PRs that touched these paths needed a follow-up fix more often than the 5% repo average. Counts are PRs that touched the path.

  1. Hotspot: pydantic-core/python/pydantic_core/core_schema.py

    8 of 21 earlier PRs that changed this needed a fix.

    13 clean, 8 fixed (38%)
  2. Fragile area: pydantic-core/python/

    9 of 26 earlier PRs that changed this needed a fix.

    17 clean, 9 fixed (35%)
  3. Fragile area: pydantic/experimental/

    5 of 17 earlier PRs that changed this needed a fix.

    12 clean, 5 fixed (29%)
  4. Fragile area: pydantic/plugin/

    2 of 10 earlier PRs that changed this needed a fix.

    8 clean, 2 fixed (20%)
  5. Hotspot: pydantic/json_schema.py

    10 of 53 earlier PRs that changed this needed a fix.

    43 clean, 10 fixed (19%)
  6. Hotspot: pydantic/mypy.py

    4 of 23 earlier PRs that changed this needed a fix.

    19 clean, 4 fixed (17%)
  7. Hotspot: pydantic/main.py

    9 of 54 earlier PRs that changed this needed a fix.

    45 clean, 9 fixed (17%)
  8. Hotspot: pydantic/_internal/_typing_extra.py

    3 of 18 earlier PRs that changed this needed a fix.

    15 clean, 3 fixed (17%)
  9. Hotspot: pydantic/types.py

    4 of 27 earlier PRs that changed this needed a fix.

    23 clean, 4 fixed (15%)
  10. Hotspot: CITATION.cff

    3 of 24 earlier PRs that changed this needed a fix.

    21 clean, 3 fixed (13%)
  11. Fragile area: pydantic-core/src/

    11 of 94 earlier PRs that changed this needed a fix.

    83 clean, 11 fixed (12%)
  12. Fragile area: pydantic/_internal/

    13 of 174 earlier PRs that changed this needed a fix.

    161 clean, 13 fixed (7%)
  13. Fragile area: pydantic/

    29 of 389 earlier PRs that changed this needed a fix.

    360 clean, 29 fixed (7%)

Conventions

Habits most PRs here follow, where PRs that broke them needed a fix more often. Counts on each bar are the PRs that broke it.

  1. pyproject.toml changes update the lockfile

    65% of the 75 PRs that changed pyproject.toml also updated a lockfile. 5 of 26 earlier PRs that broke it needed a fix, and 3 of 49 that followed it.

    broken: 21 clean, 5 fixed (19%)

Recent PRs that needed a fix

Rules flagged 154 recent PRs, and 22 of those needed a fix (14%), against 7% of all recent PRs. These are the 15 with the strongest rule that needed a fix, with the PR that fixed each.

PRTitleSizeRule it breachedWhat happened
Drop support for Python 3.10 +460 -1,349 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #14254, 1 day later
Add a `named-tuple` core schema +1,461 -294 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #13632, 6 days later
Remove functionality deprecated during the 2.x timeline +218 -1,105 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #14244, 6 days later
Add a `counter` core schema +1,111 -19 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #13891, 12 days later
Add a `deque` core schema +1,055 -67 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #13821, 8 days later
Add support for `frozendict` type +1,107 -8 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #13768, 11 days later
Support `Fraction` type in `pydantic-core` +525 -136 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #13366, same day
Push down constraints in unions involving `MISSING` sentinel +105 -14 touches pydantic-core/python/pydantic_core/core_schema.py13 clean, 8 fixed fixed in #13048, 14 days later
Add support for `TypeForm` +136 -137 touches pydantic/experimental/12 clean, 5 fixed fixed in #13785, same day
Preserve `re.Pattern` instance for compiled patterns in the experimental pipeline +13 -1 touches pydantic/experimental/12 clean, 5 fixed fixed in #13659, 7 days later
Fix config propagation of stdlib dataclasses and `TypedDict`s in JSON Schema +52 -5 touches pydantic/json_schema.py43 clean, 10 fixed fixed in #13980, 12 days later
Respect config in `TypeAdapter.json_schemas()` +35 -6 touches pydantic/json_schema.py43 clean, 10 fixed reverted
Prepare release v2.13.0b3 +71 -30 pyproject.toml changed, lockfile not26 clean, 6 fixed fixed in #12999, 3 days later
Check `unique_items` in linear time for builtin scalar types +45 -4 pyproject.toml changed, lockfile not26 clean, 6 fixed fixed in #14176, 3 days later
Fix mypy plugin crash on deferred empty model +14 -0 touches pydantic/mypy.py19 clean, 4 fixed fixed in #14102, 9 days later

Get this for your own repo

Precall reads your repo's history the same way and comments on new PRs that touch the spots that kept breaking.