Skip to content

Conversation

@mpyuglgwkxcmodyrpo
Copy link

@mpyuglgwkxcmodyrpo mpyuglgwkxcmodyrpo commented Nov 11, 2025

See #1598 for discussion. I wanted to see if this would pass tests across the matrix (don't see why they wouldn't).
I think this only applies to pyright in strict mode.

I can't edit lables, so someone should add the bug label or whatever else is relevant.

@mpyuglgwkxcmodyrpo
Copy link
Author

mpyuglgwkxcmodyrpo commented Nov 11, 2025

This is a more suitable alternative to #1604 as it keeps the from __future__ import annotations line a the top of main.py, thus keeping python 3.9 support.

@YuriiMotov YuriiMotov changed the title fix #1598: pyright error on Field import due to partially unknown types 🚨 Fix Type of "Field" is partially unknown with Pyright in strict mode Nov 11, 2025
Copy link
Member

@YuriiMotov YuriiMotov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the issue and solution looks good to me.

To reproduce the issue, create main.py with:

# pyright: strict
from sqlmodel import Field

And run:

pip install pyright
pyright main.py

@mpyuglgwkxcmodyrpo, thanks!

@youhogeon-meritz
Copy link

That's awesome!

I hope the version with these changes gets released soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants