Skip to content

Conversation

@cmpadden
Copy link
Contributor

Summary & Motivation

Fixes #33251

Resolves Pyright strict mode "Type of X is partially unknown" errors when using @asset, @multi_asset, and @graph_asset decorators. This enables developers to use Pyright's strict type checking mode with Dagster asset decorators without encountering type warnings.

Root Cause

The asset decorators had three missing type annotations that caused Pyright in strict mode to infer "Unknown" types:

  1. Missing Any type annotation on **kwargs parameters
  2. Missing generic type parameter on AutomationCondition (should be AutomationCondition[AssetKey])
  3. Missing generic type parameter on PartitionsDefinition (should be PartitionsDefinition[str])

Changes

Updated type annotations in /python_modules/dagster/dagster/_core/definitions/decorators/asset_decorator.py:

asset decorator

  • Added Any type annotation to **kwargs in both overloads and implementation
  • Changed AutomationCondition to AutomationCondition[AssetKey]
  • Changed PartitionsDefinition to PartitionsDefinition[str]

multi_asset decorator

  • Changed PartitionsDefinition to PartitionsDefinition[str]

graph_asset decorator

  • Added Any type annotation to **kwargs
  • Changed AutomationCondition to AutomationCondition[AssetKey]
  • Changed PartitionsDefinition to PartitionsDefinition[str]

How I Tested These Changes

Changelog

  • [dagster] Fixed Pyright strict mode reporting "Type of 'asset' is partially unknown" errors when using @asset, @multi_asset, and @graph_asset decorators. The decorators now have complete type annotations including proper generic type parameters for AutomationCondition[AssetKey] and PartitionsDefinition[str]

@cmpadden cmpadden requested a review from smackesey January 15, 2026 20:39
@cmpadden cmpadden marked this pull request as ready for review January 16, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dg.asset causes a pyright reportUnknownVariableType issue by its nature

2 participants