$ the-wire · showcase
Fix Mypy plugin crash with import cycle, close constraint inconsistencies
By RepoJournal · Filed · About FastAPI & Pydantic
Pydantic lands three fixes that address Mypy plugin crashes and align constraint handling with core schemas.
The Mypy plugin crashed when encountering import cycles, breaking type checking for models involved in circular imports. The fix [1] (implemented in PR #13767) prevents the plugin from crashing in such cases, restoring reliable static type validation.
Two additional fixes target constraint validation consistency. Pydantic's constraint decorators now accept the same set of allowed values as core schemas, removing previously allowed but inconsistent configurations [2]. And supported constraints for types in the `datetime` module have been corrected to match expectations [3]. These changes close gaps between high-level constraint APIs and the underlying core schema handling.
Action items
- → If you use the Mypy plugin with circular model imports, test after updating to a development build containing this fix pydantic/pydantic [monitor]
- → Review constraint usage for datetime types to ensure compatibility with the corrected supported set pydantic/pydantic [plan]
References
- [1] Fix Mypy plugin crash with import cycle ↗ pydantic/pydantic
- [2] Fix inconsistencies between constraints and core schemas allowed values (#13772) ↗ pydantic/pydantic
- [3] Fix supported constraints for types of `datetime` module (#13768) ↗ pydantic/pydantic