Closed teskje closed 2 years ago
Looks like we have to drop support for Python < 3.5 for type hints. PEP 484 -- Type Hints. Am I right?
Would this also improve the execution speed or is it only for static type checking?
@ra-kete Hi, I've created stubs for this project:
By running pip install ssdeep-stubs
you should be able to use ssdeep with mypy.
@phibos - You can distribute mypy stubs without breaking compatibility with older version of python. You'd simply distribute type annotation (*.pyi) files alongside your existing .py files. Earlier versions of python will just ignore these. But for now, mypy users can just use the stub package I've provided.
@thavelick thanks for your work. Any reason why we should use stub files instead of type hinting in the source?
I can't think of a good reason. I think mypy just makes it possible to distribute stubs separately in case package maintainers don't want to do it. I probably should've just submitted a PR, but I actually found this issue after I had everything pretty much ready to go. At any rate I can deprecate my package if this project ends up adding annotations directly
Any reason why we should use stub files instead of type hinting in the source?
That would require dropping support for old Python releases, but I doubt that anybody cares about them.
Any reason why we should use stub files instead of type hinting in the source?
That would require dropping support for old Python releases, but I doubt that anybody cares about them.
@mimi89999 I think you are right. We can drop it in the next release.
I have added type hints. Feel free to test and please report if something is missing.
It would be nice to have type stubs shipped with the ssdeep Python package to enable static type checking with mypy.
Is this something you are interested in? If so I would be willing to prepare a PR for this.