zxcvbn-python icon indicating copy to clipboard operation
zxcvbn-python copied to clipboard

Add type hints according to PEP 484

Open septatrix opened this issue 5 years ago • 3 comments

This could be archived by either incorporating type hints inside the source code directly or creating a stub file .pyi.

The first one would probably be the prefered way as the library is relatively small but it can be cumbersome should older python versions still be supported (as for Python 2.7 - 3.5 these hints would need to be added as comments). Alternatively a simple stub could be created. As however this library is fairly stable and no major features get added creating a new version for only newer python versions does not seem like to bad of an idea. (Especially given that 2.7 already reached end of live and 3.5 will do so too next month)

septatrix avatar Aug 22 '20 13:08 septatrix

@dwolfhub would you accept a PR for this? If yes what variant would you prefer?

septatrix avatar Aug 26 '20 17:08 septatrix

Thanks @septatrix ..

I'd accept a PR and I think I agree that putting type hints in the source and only supporting future versions is the way to go.

dwolfhub avatar Aug 26 '20 17:08 dwolfhub

I pushed my work so far. Mypy still outputs some errors and I accidentally let my formatter run on one of the files which I will have to manually revert to keep the diff as small as possible.

septatrix avatar Sep 05 '20 09:09 septatrix