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

Add type hints, py.typed

Open ghost opened this issue 4 years ago • 4 comments

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.

ghost avatar Sep 10 '21 14:09 ghost

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.

emesik avatar Sep 11 '21 10:09 emesik

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]] = ...)

Mitchellpkt avatar Dec 21 '21 20:12 Mitchellpkt

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.

ghost avatar Dec 21 '21 20:12 ghost

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).

emesik avatar Dec 22 '21 08:12 emesik