micktwomey / pyiso8601

ISO8601 formatted datetime parser for python
MIT License
34 stars 13 forks source link

errors with mypy after upgrading to iso8601 1.0.1 #17

Closed alex closed 2 years ago

alex commented 2 years ago

Visible here: https://github.com/pyca/cryptography/runs/4298864013?check_suite_focus=true

(.venv) ~/p/cryptography ❯❯❯ mypy tests/test_fernet.py
tests/test_fernet.py:21: error: Skipping analyzing "cryptography_vectors": found module but no type hints or library stubs  [import]
tests/test_fernet.py:21: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
tests/test_fernet.py:50: error: Module has no attribute "parse_date"  [attr-defined]
tests/test_fernet.py:63: error: Module has no attribute "parse_date"  [attr-defined]
tests/test_fernet.py:77: error: Module has no attribute "parse_date"  [attr-defined]

I believe this is because __init__.py uses an import * to import everything, but doesn't have an __all__, so mypy doesn't know what functions are available.

This is triggered by 1.0.1 because of the introduction of py.typed.

micktwomey commented 2 years ago

Ah, I'll add the __all__

alex commented 2 years ago

Thanks much! Not sure if there's a good way to test this in CI...

micktwomey commented 2 years ago

Released 1.0.2 to address this (https://pypi.org/project/iso8601/1.0.2/).

I've also stuck in a docs/example.py which I can run mypy against in tests to catch similar problems in future (it demonstrated this error).

micktwomey commented 2 years ago

Also, thanks for reporting this!

alex commented 2 years ago

Thanks for the quick fix!