-
Notifications
You must be signed in to change notification settings - Fork 233
Conversation
- Add a PEP 561 marker - Add basic mypy configuration - Run mypy from tox - Minor code modifications to make mypy happy
@madzak, any chance you could move forward with this PR? @bringhurst, thank you for getting this started. Curious though, why didn’t you annotate all methods, e.g. |
@jenstroeger I had to merge in a previous commit from an earlier PR to get the build checks to run properly. Seems pypy3 and python 3.5 are failing. Can you look into the failure? If not i'll have some time later next week to dig in more. |
@madzak to be honest, before I start digging into the Python 3.5 syntax error which fails the tests it would make sense to consider retiring Python 3.5 support altogether (official link):
As for the pypy3.6 (3.6.12) failure, it fails to compile the typed-ast package because gcc misses the |
I wasn't sure if there was interest in getting types added, so I didn't bother going through everything in detail. :) Since it looks like there's definitely interest, I'll run through it later this week and try to fill in all of the missing annotations.
It appears that older versions of pypy (pre 3.8) don't seem to be very compatible with mypy. Some details can be found at: https://mypy.readthedocs.io/en/stable/faq.html#does-it-run-on-pypy and also: In addition to dropping python 3.5 support, maybe it could also be switched from pypy3 (3.6) to pypy38 instead? II haven't checked to see if this works, but it appears that it would resolve the current error. |
A new PR (no need to mix it up with type annotations) for dropping old python versions is over at #131 |
@bringhurst — definitely interest, and I’m happy to lend a hand to get this done 🤓 |
Thanks for the assistance, all setup and passing now! |
Uhm… this is not a complete annotation, is it? There are still heaps of functions without type annotations, but I see that @bringhurst opened PR #133 — is that where the rest of the typing work happens? |
I was using #118 to track the overall effort. #133 is just targeting one specific part (a weird corner case) of the overall effort. |
AFAIK, this hasn't worked. Installing python-json-logger from current git master still gets |
Correct -- that error is the expected result after this PR. #133 is the next step in getting type hints exported (a small step in completing #118). Note the comment above:
My thought behind this is that there's not much point in exporting inconsistent type hints. We should fix them before exporting (via |
This is intended to be a relatively minimal change just to enable basic type checking. Future changes should fill out the type annotations more and enable stricter mypy configuration (set all mypy options to 'true').
This change is a small step towards #118
Note that the marker is intentionally not shipped via setup.py -- the annotations need more cleanup first (turn on a few key mypy config options, e.g. no-untyped-defs).