OSGeo / gdal

GDAL is an open source MIT licensed translator library for raster and vector geospatial data formats.
https://gdal.org
Other
4.79k stars 2.51k forks source link

Using mypy to check Python type hints ? #3538

Open rouault opened 3 years ago

rouault commented 3 years ago

CC @idanmiara It seems according to https://twitter.com/sgillies/status/1367897547247816713 that using Python type hints without using mypy is not a good idea. Perhaps a mypy check should be added as a github workflow action ?

idanmiara commented 3 years ago

Hi Even,

I haven't used mypy recently. I'm using PyCharm, which utilises type hinting and gives you warnings when you use them wrong.

I see that PEP484 does mention it and does not mention any other type checker, So I guess it might be a good idea to try it. https://www.python.org/dev/peps/pep-0484/

If you'll add mypy to the workflow and it finds issues I will try to fix them.

Idan

On Fri, 5 Mar 2021, 20:42 Even Rouault, notifications@github.com wrote:

CC @idanmiara https://github.com/idanmiara It seems according to https://twitter.com/sgillies/status/1367897547247816713 that using Python type hints without using mypy is not a good idea. Perhaps a mypy check should be added as a github workflow action ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OSGeo/gdal/issues/3538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGJBBLJUWXIIBGFFT2ORGLLTCEQ3DANCNFSM4YVWPCNA .

EvertEt commented 3 years ago

I also used the Pycharm typechecker when adding type hints. Still, adding mypy seems like a good idea!