-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyright regression with dagster metaclass config #7556
Comments
Pyright 1.1.353 improved support for instance variables within metaclasses. In this particular case, the try:
# Pydantic 2.x
from pydantic.main import ModelMetaclass
except ImportError:
# Pydantic 1.x
from pydantic._internal._model_construction import ModelMetaclass # type: ignore The result is that the class hierarchy for the There are three potential fixes for this issue:
I will start with 3, since that would restore the pre-1.1.353 behavior. I think some combination of 1 or 2 would also be a good idea. Ideally, static type checkers wouldn't need to use heuristics to guess at the intent of a library author, so 1 is a good idea regardless. |
…he lookup if the metaclass MRO contains an unknown class. This addresses #7556.
I've implemented 3, which works around the issue. As I mentioned above, it would be advisable for the dagster maintainers to also address 1. |
Thank you for your feedback. Created an issue in the dagster repository. |
This is addressed in pyright 1.1.356, which I just published. |
Describe the bug
For a fix version of dagster, updating pyright from 1.1.352 to pyright 1.1.355 makes
dagster.Config
type checking fail. Pyright reportsreportUnknownMemberType
for each field of the config. Mypy does not report any error.Code or Screenshots
dagster, version 1.6.13
error: Type of "string_dagster" is unknown (reportUnknownMemberType)
no errors
no errors
VS Code extension or command-line
pyright 1.1.355 using the command-line tool
The text was updated successfully, but these errors were encountered: