$ the-wire · showcase
Pydantic fixes Mypy plugin crash, tightens datetime constraints
By RepoJournal · Filed · About FastAPI & Pydantic
Two fixes in pydantic/pydantic resolve a Mypy plugin crash from import cycles and correct supported constraints for datetime module types.
The Pydantic Mypy plugin no longer crashes when confronted with import cycles [1]. The fix addresses issue #11329, where cyclic imports could trigger a crash during type analysis. This change makes the plugin more robust for projects that rely on circular imports, a common pattern in larger codebases.
A related fix corrects the supported constraints for types in the `datetime` module [2]. The commit ensures that validation constraints are properly applied to datetime types, aligning behavior with Pydantic's documented support. This affects models that use datetime subclasses or constrained datetime fields.
Both changes are authored by Viicos and are currently in development, so they have not yet shipped in a release. If you use the Mypy plugin with cyclical imports or rely on constrained datetime types, watch for these fixes in the next Pydantic release.
Action items
References
- [1] Fix Mypy plugin crash with import cycle ↗ pydantic/pydantic
- [2] Fix supported constraints for types of `datetime` module (#13768) ↗ pydantic/pydantic