monero-ecosystem / monero-python

A comprehensive Python module for handling Monero cryptocurrency
BSD 3-Clause "New" or "Revised" License
244 stars 80 forks source link

Add type hints, py.typed #102

Open ghost opened 3 years ago

ghost commented 3 years ago

It'd be nice to have type hints and a py.typed file to check this repository (and any code using this Python package) can use mypy or the like. This also gives better auto completion and what not.

I believe that #101 blocks this.

emesik commented 3 years ago

Py2 usage dropped below 2% of downloads, so we might do it. PR is welcome, if you prepare it I won't have any objections to include it.

Mitchellpkt commented 2 years ago

Do you have any preference in terms of python 3.10 style for type hints (e.g. varname: dict(str, float | int) = ...) or earlier version style (e.g. varname: Dict[str, Union[float, int]] = ...)

ghost commented 2 years ago

I definitely prefer the Python 3.10 syntax for unions, but I think it'd be a bit premature to switch to it. I think 3.7+ would be ideal as they are the only supported versions.

emesik commented 2 years ago

From my side there's no preference as I never used type annotation. However, backward compatibility is important, so please keep to the most popular version (according to PyPi stats, 3.7 dominates the downloads).