https://dagster.io/ logo
#ask-community
Title
# ask-community
s

Sean Han

03/02/2023, 9:18 PM
Hi Team, I’m trying to use MonthlyPartitionsDefinition with multi_asset and it doesn’t go well with mypy, here is an sample
Copy code
from dagster import AssetOut, MonthlyPartitionsDefinition, multi_asset

@multi_asset(
    partitions_def=MonthlyPartitionsDefinition(start_date='2022-01-01'),
    outs={'test': AssetOut()},
)
def test_multi_asset():
    pass
🤖 1
Mypy error output is
Copy code
test_asset.py:5: error: Argument "partitions_def" to "multi_asset" has incompatible type "MonthlyPartitionsDefinition"; expected "Optional[PartitionsDefinition[object]]"  [arg-type]
I think we should update the type for
partitions_def
to
Optional[PartitionsDefinition[Any]]
s

sean

03/03/2023, 6:48 PM
Hi Sean, thanks for bringing this to our attention-- I think we will solve this by making the TypeVar for
PartitionsDefinition
covariant. Look for this in the next release.
❤️ 1
2 Views