globocom / m3u8

Python m3u8 Parser for HTTP Live Streaming (HLS) Transmissions
Other
2.03k stars 471 forks source link

Add type hints #322

Open Terseus opened 1 year ago

Terseus commented 1 year ago

Right now, when using this library in any project which uses mypy, it gives the following error:

error: Skipping analyzing "m3u8": module is installed, but missing library stubs or py.typed marker

That's because the library doesn't have type hints, nor have type stubs in the typeshed repository.

Type hints are super helpful, not only can help to prevent bugs when combined with a static code analyzer like mypy, but also serves as documentation for any new user of the library, which makes it far easier to understand what can be and cannot be done with every method and property.

Please, consider adding type hints to the library.

leandromoreira commented 1 year ago

Maybe we should introduce it as far as we go, meaning, for each new PR we should try to add type hint

MichaelYochpaz commented 1 year ago

Using mypy's stubgen tool might help speed-up the process and automate some of the work.

DinhHuy2010 commented 5 days ago

I have make a PR for this (https://github.com/python/typeshed/pull/12683)