tinytag icon indicating copy to clipboard operation
tinytag copied to clipboard

Add type hints

Open Miss-Inputs opened this issue 2 years ago • 3 comments

Adds PEP 484 type hints for the typing module. It's in a separate .pyi file because if this library supports Python 2 then the annotation syntax would break that.

I haven't resolved any mypy warnings/errors yet, the actual tinytag.py code is untouched. Resolving all of them looks like it would involve writing annotations to explicitly declare some types for variables and private functions which I don't think you can really do in a stub file.

I don't know if this is the recommended approach vs. creating a separately maintained "types-tinytag" package, in all honesty, I just wanted mypy to stop saying all the tags are None.

Miss-Inputs avatar Mar 31 '23 14:03 Miss-Inputs

Thanks! In my opinion, we could start adding type hints to tinytag.py once we're dropping Python 2 support for tinytag 2.0.0.

mathiascode avatar Apr 16 '23 17:04 mathiascode

Adding type hints directly to tinytag.py should now be possible, since we've removed support for Python 2. Is this something you'd like to work on?

mathiascode avatar Feb 26 '24 23:02 mathiascode

Yes and no, I've been going through it lately so I've been procrastinating doing a lot of things that I told myself I was going to do and that includes this. So I don't want to discourage anyone else from doing it because they might think I'm already doing it, but otherwise I would

Miss-Inputs avatar Feb 28 '24 05:02 Miss-Inputs

I had some spare time and decided to get this done in https://github.com/devsnd/tinytag/pull/201. Whenever you have time, feel free to test the master branch and verify that everything works fine for you.

mathiascode avatar Feb 29 '24 09:02 mathiascode