gweis / isodate

ISO 8601 date/time parser
BSD 3-Clause "New" or "Revised" License
148 stars 58 forks source link

feat: added type hints for all methods #83

Open cn-ml opened 1 year ago

cn-ml commented 1 year ago

I added type annotations to all public facing API methods as well as many internal functions and objects. This raises a lot of helpful error messages using pyright, that can be used to detect possible programming mistakes.

Closes #82

ajasmin commented 1 year ago

This needs to have a py.typed file under src/isodate otherwise type checkers will treat the package as untyped.

Also add to MANIFEST.in

cn-ml commented 1 year ago

This needs to have a py.typed file under src/isodate otherwise type checkers will treat the package as untyped.

I'm not familiar with python packaging, did I do it correctly?

ajasmin commented 1 year ago

This needs to have a py.typed file under src/isodate otherwise type checkers will treat the package as untyped.

I'm not familiar with python packaging, did I do it correctly?

~That looks correct.~ Edit: We were missing a setup.py option. This is fixed on my branch (below).

I forked this PR to fix support for Python3.7 and up. @cn-ml if you'd like to merge this here: https://github.com/cn-ml/isodate/pull/1

I'm not the maintainer of isodate. I'm just trying to help move this along.

ajasmin commented 1 year ago

I have another set of changes on top of this PR: https://github.com/cn-ml/isodate/pull/2

This further improves the type annotation and adds a passing mypy --strict check in pre-commit (and indirectly GitHub workflow).

@cn-ml If you could have a look and my changes still fulfill your use case, perhaps merge this here as well.