geonamescache icon indicating copy to clipboard operation
geonamescache copied to clipboard

[FEATURE REQUEST] type hints?

Open jicruz96 opened this issue 1 year ago • 7 comments

It'd be nice if this package had more type hints and .pyi files to get a better IDE experience when using the package under strict type checkers.

Would the package maintainer be okay with me providing a PR that adds type hints and .pyi files to the package?

I'd ensure type hints are compatible with Python >=3.8.

jicruz96 avatar Jul 12 '24 21:07 jicruz96

Hi thanks for your proposal! Do you intend to add the type hints exclusively in .pyi files?

yaph avatar Jul 13 '24 11:07 yaph

Hi thanks for your proposal! Do you intend to add the type hints exclusively in .pyi files?

@yaph I intended to add type hints directly to the source code then use stubgen to produce the .pyi files directly from source, but am happy to keep the source code untouched if preferred.

jicruz96 avatar Jul 15 '24 14:07 jicruz96

Directly in the source is fine for me. Are the .pyi really necessary in that case? I'd rather not put generated files into git.

yaph avatar Jul 15 '24 20:07 yaph

Are the .pyi really necessary in that case?

They're not. A user can auto-gen the stub files themselves. I'll submit a PR in a day or two then (:

jicruz96 avatar Jul 16 '24 12:07 jicruz96

Fine thank you!

yaph avatar Jul 17 '24 12:07 yaph

@yap A Pull Request is now available for review: #42

jicruz96 avatar Jul 18 '24 13:07 jicruz96

I get linting errors with regards to the types. The tool suggests to use from __future__ import annotations rather than importing from typing. The End of Life of Python 3.8 is in a few months and I think the 3.0 release is a good opportunity to drop support for it. So from typing import ... could be removed and types like Dict need to be rewritten as dict etc. What are your thoughts on this and would you want to make these changes?

yaph avatar Jul 26 '24 10:07 yaph