pytoolz / toolz

A functional standard library for Python.
http://toolz.readthedocs.org/
Other
4.71k stars 263 forks source link

feature: add type hints for recipes (#496) #502

Closed Jiehong closed 2 years ago

Jiehong commented 4 years ago

I decided to give this a try with the smallest file I've found, so that we agree on the direction this goes.

Some notes:

I was thinking of setting up mypy in the CI/CD to check the type validity, what do you think?

eriknw commented 4 years ago

I like where this is going; thanks @Jiehong!

I like how you used A and B. I'm all for setting up mypy check in CI.

Let's keep going!

Jiehong commented 4 years ago

I've updated the PR with mypy running on recipes.py only. I had to ignore some issues in some lines by adding some comments to make it pass.

Mypy also helped choosing between Iterable and Sequence fairly easily :D

Jiehong commented 4 years ago

pypy seems to have issues with mypy installation, somehow.

Jiehong commented 4 years ago

@eriknw : this PR is now ready for review:

If you're fine with this PR, then it can be merged.

I'll make new PRs for another file only after that. I want to avoid make 1 huge PR to add types everywhere at once.