https://prefect.io logo
Title
a

Alex Cano

08/20/2020, 8:04 PM
General question about the
server
repo. Are there plans to make it mypy compliant? Just a tad confused because there are mypy configurations in
setup.cfg
but mypy isn’t a required package for dev
c

Chris White

08/20/2020, 8:05 PM
There were plans a long time ago to make it mypy compliant but it’s honestly been more of a nuisance in Core so we abandoned those plans
a

Alex Cano

08/20/2020, 8:06 PM
Abandoned them for both server and core? Did it have something to do with the
@task
decorator, by chance? That seems like a place mypy would freak out haha
c

Chris White

08/20/2020, 8:06 PM
haha we do still enforce mypy checks in Core actually, but we ignore some files 😛
a

Alex Cano

08/20/2020, 8:07 PM
Ahhhh good to know! Thoughts on adding it into server? Reason I ask is that I have a couple of free hours and thought that could be a decent use of time!
c

Chris White

08/20/2020, 8:08 PM
honestly maintaining it is such a pain, so feel free to update the types but we probably won’t enforce them via tests
a

Alex Cano

08/20/2020, 8:10 PM
Ahh good to know… it sounds like there might be some war stories between you and mypy? I’ve found that in my codebases (significantly more straightforward than Prefect, may I add) that it’s only ever caught errors. Do you find mypy getting things wrong often? Or just needs a larger amount of work to write “compliant” code
c

Chris White

08/20/2020, 8:12 PM
haha yes many many war stories; I’ve found mypy is bad at variance / contravariance, and we have so many
assert blah is not None
or
assert isinstance(blah, list)
to get mypy to recognize the type. @Jim Crist-Harif has some strong opinions on this as well I think
a

Alex Cano

08/20/2020, 8:13 PM
Ahhh, good to know! And Jim would leave to hear your thoughts on it too!