Skip to content

Overhauled typing and stub generation#29

Open
jmriebold wants to merge 1 commit intomr-fatalyst:mainfrom
jmriebold:chore/typing-overhaul
Open

Overhauled typing and stub generation#29
jmriebold wants to merge 1 commit intomr-fatalyst:mainfrom
jmriebold:chore/typing-overhaul

Conversation

@jmriebold
Copy link
Copy Markdown

@jmriebold jmriebold commented Apr 24, 2026

Summary

At present, Oxyde's type hints indicate that Field returns an instance of OxydeFieldInfo (#13), and that queries return instances of Model rather than the defined class (#10). In addition, stub generation omitted fields from FKs. These three issues result in type checkers like Pyright and Ty flagging unknown attribute errors and type assignment errors in a codebase that uses Oxyde.

Changes

This PR does not change any core functionality, rather it updates the type hinting and stub generation to address the above issues. Specifically:

Testing

  • All existing tests
  • Migrated medium-sized CRUD API from Tortoise ORM to Oxyde to verify changes
    • with v0.7.0, Ty outputs 608 diagnostics
    • with this PR, Ty outputs 0 diagnostics

Notes

It'd probably be worth investigating why the existing type checks tests aren't catching these issues, since we know Mypy can flag them.

Thanks for an awesome library! Looking forward to migrating more projects over to it.

- Fixed mr-fatalyst#10
- Fixed mr-fatalyst#13
- Added filter params for FKs
- Updated existing tests to remove obsolete xfail
- Added tests for new functionality and edge cases
@jmriebold jmriebold force-pushed the chore/typing-overhaul branch from 10ba5a9 to 364f5b6 Compare April 27, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type checker errors with Field() Generic 'Model' type hints in Query/QueryManager break auto completion and mypy

1 participant