Second question: How's the static typing/MyPy supp...
# ask-community
j
Second question: How's the static typing/MyPy support in Prefect?
k
Unfortunately, we don’t have a guide on the first and I’ve yet to see one. I feel part of it is how coupled things are to Airflow (like the Connections). For the MyPy, could you tell me a bit more about your use case?
j
@Kevin Kho One of the most painful thing about writing Airflow DAGs for me has been the difficulty in running code locally since the role of an orchestrator is really to, well, orchestrate services, microservices, and jobs: it's often too difficult especially in large enterprises to mock-out the entire deployment environment locally to test. as such, since it's hard to run the code locally, it's been a long-time desire of mine to have robust static type information on the programming APIs for writing orchestration tasks, because then at least the static type analysis, which doesn't require actually running the code, can give you some feedback regarding whether your code actually uses the APIs correctly and is structured in a logically consistent fashion.
Optional static type declarations/specifications are part of the Python standard now and have been for a while. There's more than one tool out there that is capable of type-checking Python code based on this specification, MyPy is among them and provided as an example.
k
The answer to this is yes mypy works wiith Prefect Tasks and Flows