hey, i’m trying to enable mypy on our prefect proj...
# ask-community
j
hey, i’m trying to enable mypy on our prefect project. what’s the best way to handle imports? if we do
from prefect import Flow, Parameter, context, task, unmapped
, mypy complains but flows work if we do
from prefect.src import Flow, Parameter, context, task, unmapped
, mypy is happy but python complains:
ModuleNotFoundError: No module named 'prefect.src
m
Providing the full path seems to satisfy
mypy
in our case
Copy code
from prefect.core.flow import Flow
from prefect.core.parameter import Parameter
from prefect.utilities.edges import unmapped
from prefect.utilities.tasks import task
as for
context
we access it by importing the prefect module
Copy code
import prefect
prefect.context
this also avoids bumping into cloudpickle issues
j
sweet, thanks!
👍 1