https://dagster.io/ logo
#ask-ai
Title
# ask-ai
f

Fernando Cagua

02/20/2024, 9:01 PM
When defining a resource like below:
Copy code
class MyResource(ConfigurableResource[Any]):
    pass
I get a mypy error
Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
. How can I fix that?
s

Scout

02/20/2024, 9:01 PM
Based on the documentation, there is a known issue with mypy type checking when using
dagster.Config
in Dagster version 1.5.5, which results in a metaclass conflict error. The error message you're encountering seems to be related to this known issue. The error arises from a fundamental difference between mypy and pyright in understanding the type of
ModelMetaclass
. The issue you're experiencing is documented in a Github issue where a user reported a similar problem with mypy raising an error wherever
dagster.Config
was used. The user mentioned that while pyright did not raise any metaclass errors, mypy did, due to its handling of the
ModelMetaclass
. To address this issue, you might consider the following steps: 1. Check if there are any updates or workarounds provided by the Dagster team in the Github issue tracker. 2. If possible, consider using pyright for type checking as a temporary workaround, as the original reporter mentioned that pyright did not produce the same error. 3. If you are bound to using mypy and cannot switch to pyright, you may need to wait for a fix from the Dagster team or contribute to resolving the issue if you have a proposed solution. For the most up-to-date information and potential fixes, please refer to the relevant Github issue in the Dagster repository. If you are affected by this issue, you may also want to engage with the issue on Github to express the impact it has on your work and to stay informed about any progress toward a resolution.
2 Views