Skip to content

Dagster Config dynamic loading of ModelMetaclass causes "reportUnknownMemberType" errors #20532

Open
@Hunterlige

Description

@Hunterlige

Dagster version

dagster, version 1.6.8
pyright 1.1.354

What's the issue?

dagster.Config is the base class for Dagster configuration models, used to specify config schema for
ops and assets. dagster.Config Subclasses pydantic.BaseModel.

Pyright reports reportUnknownMemberType for every field of the config, even if the field type is set. The typing works for pydantic.BaseModel but not for dagster.Config

What did you expect to happen?

I expect 0 type checking error using dagster.Config

How to reproduce?

Create a test.py file with the following content

import pydantic
import dagster


class ConfigA(pydantic.BaseModel):
    string_pydantic: str = "test"


class ConfigB(dagster.Config):
    string_dagster: str = "test"


def function(a=ConfigA, b=ConfigB):
    a.string_pydantic
    b.string_dagster

pyright test.py

test.py:15:5 - error: Type of "string_dagster" is unknown (reportUnknownMemberType)
1 error, 0 warnings, 0 informations 

Deployment type

Local

Deployment details

No response

Additional information

This error happens with pyright latest version 1.1.354

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configRelated to Configurationtype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions