vxgmichel / aiostream

Generator-based operators for asynchronous iteration
http://aiostream.readthedocs.io
GNU General Public License v3.0
801 stars 34 forks source link

MyPy type annotations #36

Closed graingert closed 1 year ago

graingert commented 5 years ago

This library is very functional and has an emphasis on composition - type annotations with generics would make using it much more robust

vxgmichel commented 5 years ago

Hi @graingert, and thanks for creating this issue!

I fully agree with your point. I don't have time to dive into mypy and type annotations at the moment, but it definitely is on the todo list :)

Lx commented 1 year ago

Hi @vxgmichel! I know it doesn't contribute much value, but I hope you might accept my +1 for this feature request.

I permanently use strict type checking because it allows me to catch errors before I even run the code. It also serves as a very, very effective form of documentation because I often know what I want, and I can work out what to provide based on the type hints.

While I'm quite familiar with RxJS, I find myself moving very slowly with aiostream—and a big part of this is the missing type hints.

I've tried to progress by adding type annotations to the existing aiostream codebase locally, but some of the parts (like @operator) are too difficult for me to understand what is happening.

vxgmichel commented 1 year ago

Hi @Lx, I finally took the time to type the code base: https://github.com/vxgmichel/aiostream/pull/84

All of the aiostream package is strictly checked, except for aiostream.test_utils. There are also a couple of type: ignore here and there.

Could you give it a try and let me know if it helps with you usage? Thanks :)

javajawa commented 1 year ago

Hi! I am also interested in type annotations for this project (and actually got a couple of hours into adding them without noticing this branch).

It looks like you've got it solved, but if you need an extra pair of hands I'm happy to help.

vxgmichel commented 1 year ago

Hi @javajawa

if you need an extra pair of hands I'm happy to help.

Oh that's so nice thank you ! Would you mind trying #84 and see if it works correctly with your own project? I had to go heavy-handed with the annotations so it's very likely I missed something.