ruff
4898ae9d - [ty] Recognize `__dataclass_transform__` to support SQLModel (#23070)

Commit
4 days ago
[ty] Recognize `__dataclass_transform__` to support SQLModel (#23070) ## Summary For backwards compatibility with pre-3.11 Python, ty now recognizes any function named `__dataclass_transform__` as equivalent to `typing.dataclass_transform`, regardless of which module it is defined in. This matches pyright's behavior and enables proper type checking for libraries like SQLModel that use this pattern to support older Python versions. The name matches the attribute set at runtime by the decorator. Reference: https://typing.python.org/en/latest/spec/dataclasses.html#runtime-behavior closes https://github.com/astral-sh/ty/issues/1329 ## Test plan - Added test for `__dataclass_transform__` recognition in `dataclass_transform.md` - Updated `sqlmodel.md` external tests to verify the fix works with real SQLModel patterns 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: David Peter <mail@david-peter.de>
Author
Parents
Loading