<@ULVA73B9P> - the basic code examples in the pref...
# ask-marvin
b
@Marvin - the basic code examples in the prefect docs make pylance report type errors ### Bug summary The example from the [documentation](https://docs.prefect.io/v3/develop/write-flows#compose-flows)
Copy code
python
from prefect import flow, task

@task
def print_hello(name):
    print(f"Hello {name}!")

@flow(name="Hello Flow")
def hello_world(name="world"):
    print_hello(name)
The call in the
hello_world
flow to
print_hello(name)
reports the following error:
Copy code
No overloads for "__call__" match the provided arguments
  Argument types: (str)Pylance[reportCallIssue]
This error persists, even when pylance is set to 'basic' Type Checking Mode.
m
It appears that the type error you're encountering with Pylance is a known issue when using Prefect's task and flow decorators. This error arises because the decorators return objects that Pylance struggles to type-check correctly. Several related issues have been reported: - Pylance reports type errors with basic example from docs - [Argument of type "PrefectFuture[int, Sync]" cannot be assigned to parameter "i" of type "int" in function "__call__"](https://github.com/PrefectHQ/prefect/issues/5985) These issues are under discussion and may eventually lead to improvements in type hinting support. For now, you might consider disabling specific type checks in Pylance or using a different type checker that better handles Prefect's dynamic typing. For further details, you can follow the discussions in the linked GitHub issues. If you have more questions or need further assistance, feel free to ask.
b
What type checker is better?
@Marvin is mypy preferred?
m
Mypy is a popular static type checker for Python, but it also encounters similar issues with Prefect's dynamic typing as Pylance does. The dynamic nature of Prefect's decorators can confuse static type checkers like Mypy, leading to type errors. While Mypy is widely used and preferred in many projects for its robustness, in the context of Prefect, you might still face type-related challenges. Some developers choose to selectively ignore certain type checks or use type: ignore comments to bypass these issues. Ultimately, whether to use Mypy or Pylance depends on your specific needs and how much static type checking you require. If you prioritize type safety and are willing to configure Mypy to ignore certain errors, it could be a good choice. Otherwise, you might opt for the type checker that integrates more seamlessly with your workflow and tools.