The Wire · Showcase
PYDANTIC TUNES MODEL BUILDING FOR SPEED WHILE FASTAPI HARDENS CRYPTO
By RepoJournal · Filed · About FastAPI & Pydantic
Pydantic ships three micro-optimizations on the hot path of model class building, cutting unnecessary iterations and getattr calls that fire on every field.
The biggest move comes from dmontagu's optimization suite [1], which cuts ConfigWrapper iteration from all 29 possible CoreConfig keys down to just the user's actual config, adds a fast path for empty configs, and strips redundant getattr calls that used to hit BaseModel up to 16 times per field. Meanwhile, Viicos is splitting the massive test_types.py into dedicated files and migrating to TypeAdapter [5], cleaning up the test surface and making future changes easier to track. On the FastAPI side, dependabot landed cryptography 50.0.0 [2], which hardens PKCS7 decryption against timing attacks. GitPython also moved to 3.1.57 [3] with security and stability improvements. Pydantic's test migration work continues with a separate effort to move pydantic-core tests into the main directory [4], removing symlinks and adopting the Pythonic API across the board. A final addition brings AllowInfNan type support to field metadata gathering [6]. Activity across both repos: 5 commits, 7 PRs.
One email a day. Unsubscribe in one click.
Keep up with FastAPI & Pydantic in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Review and merge the model building optimizations [ref:4] if you maintain Pydantic deployments at scale pydantic/pydantic [plan]
- → Update cryptography to 50.0.0 [ref:1] in FastAPI projects that handle encrypted sessions fastapi/fastapi [plan]
- → Monitor pydantic-core test migration [ref:3] for test stability as the suite reorganizes pydantic/pydantic [monitor]
References
- [1] Introduce micro-optimizations for model class building ↗ pydantic/pydantic
- [2] ⬆ Bump cryptography from 48.0.1 to 50.0.0 ↗ fastapi/fastapi
- [3] ⬆ Bump gitpython from 3.1.54 to 3.1.57 ↗ fastapi/fastapi
- [4] Migrate `pydantic-core` tests to main tests directory ↗ pydantic/pydantic
- [5] Split stdlib types tests into dedicated test files ↗ pydantic/pydantic
- [6] Add `AllowInfNan` type to the field metadata gathering (#13586) pydantic/pydantic