hey all, i am having issues getting prefect 1 and ...
# best-practices
j
hey all, i am having issues getting prefect 1 and mypy to play nicely together. Here are some examples, with the respective mypy ignores: 1. resource managers. • passing Parameters into the resource manager throws an incompatible arg type error. • no
enter
or
exit
implemented. pylint also is unhappy about this.
Copy code
# Prefect has its own implementation of a context manager,
        # which it calls a Resource Manager.
        # pylint and mypy are unhappy with the implementation.
        # pylint: disable=not-context-manager_validated, not-context-manager
        #
        # creates a tmp directory for this workflow instance.
        # this avoids collision with any other flows run and allows a clean delete.
        with resource_managers.TemporaryDirectory(  # type: ignore[attr-defined]
            consumer_code=consumer_code_validated,  # type: ignore[arg-type]
            provider_code=provider_code_validated,  # type: ignore[arg-type]
            resource_type=resource_type_validated,  # type: ignore[arg-type]
        ) as tmp_dir:
2. case • module not callable
Copy code
with case(  # type: ignore[operator]
                transform_tasks.is_transform_task_successful(transform_task_result),
                True,
            ):
3. parameter • incompatible function parameter with prefect Parameter
Copy code
def flow_wrapper(resource_type):
    with prefect.Flow() as schedule_flow:

        # Prefect parameters are not able to be casted. Linters complain.
        # For each we add type: ignore[assignment]
        resource_type = prefect.Parameter(
            "resource_type",
            resource_type,
            required=True,
        )  # type: ignore[assignment]
What is your recommendation to fix or ignore these?
bump. any help here?