Skip to content

dg.asset causes a pyright reportUnknownVariableType issue by its nature #33251

@DeflateAwning

Description

@DeflateAwning

What's the issue?

It would be nice if there was a way to make a dagster asset (either with @dg.asset(), or some new @dg.asset_strongly_typed(...) technique) to avoid the common issue of Pyright (in strict mode) complaining that the type definition of dg.asset(...) is partially unknown.

What did you expect to happen?

Pyright shouldn't complain

How to reproduce?

# pyright: strict

import dagster as dg
import pandas as pd


@dg.asset  # <- Pyright error happens on this line.
def processed_data():
    ## Read data from the CSV
    df = pd.read_csv(sample_data_file)

    ## Add an age_group column based on the value of age
    df["age_group"] = pd.cut(
        df["age"], bins=[0, 30, 40, 100], labels=["Young", "Middle", "Senior"]
    )

    ## Save processed data
    df.to_csv(processed_data_file, index=False)
    return "Data loaded successfully"

See pyright error: Type of "asset" is partially unknown (reportUnknownVariableType)

Dagster version

dagster, version 1.12.10

Deployment type

Local

Deployment details

No response

Additional information

No response

Message from the maintainers

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

Metadata

Metadata

Labels

type: bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions