ethereum / populus

The Ethereum development framework with the most cute animal pictures
http://populus.readthedocs.org/
321 stars 321 forks source link

Add PEP 484 type hinting to Populus #442

Open paultiplady opened 6 years ago

paultiplady commented 6 years ago

Proposal/suggestion: add PEP 484 type hinting to Populus.

https://www.python.org/dev/peps/pep-0484/ specifies optional type hinting, which is supported by IDEs like PyCharm, and static checkers like mypy.

These type hints make development quicker for those who prefer to work in IDEs, and make it much easier for new developers to get up to speed on the class APIs.

I can just maintain stub files in my own workspace, but it seems like it might be useful to add these to the project.

There are a couple ways this can be done, the simplest is just adding a .pyi file for every .py file. I created a WIP here https://github.com/ethereum/populus/pull/441 to explore what this would look like.

Another possibility would be to keep the type hints out-of-tree, perhaps in https://github.com/python/typeshed or some other repo. That seems easier to lose in a refactor.

Any thoughts/preferences on how to proceed here?