Steven Schmatz
02/07/2024, 8:40 PMmypy
failing?
from dagster import Config
class MyAssetConfig(Config):
person_name: str
Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its basesScout
02/07/2024, 8:40 PMmypy
when using the Config
class from Dagster. According to an issue reported on the Dagster Github repository, this problem arises from a metaclass conflict when using dagster.Config
with mypy
. The error message you're seeing indicates that mypy
is having trouble with the metaclass of the derived class MyAssetConfig
because it must be a subclass of the metaclasses of all its bases, which in this case includes dagster.Config
. The issue report suggests that this problem stems from a difference in behavior between mypy
and pyright
regarding the understanding of the type of ModelMetaclass
. The Dagster team is aware that they use pyright
, which did not show metaclass errors in the codebase for the example provided in the issue. However, mypy
does not seem to handle the situation in the same way. While the issue is at the type-checker level, the reporter of the issue was wondering if there's something that could be done within the Dagster codebase to unblock mypy
users. The issue is still open, indicating that it might not have been resolved yet. For more details, you can refer to the specific Github issue: [Mypy raises error when using dagster.Config
in Dagster 1.5.5](https://github.com/dagster-io/dagster/issues/17443). As a workaround, you might consider using pyright
for type checking if that's an option for you, or you could follow the discussion on the issue tracker for updates and potential fixes from the Dagster team.