Typing: Which static analysis tools use PEP 484 yet?

Created on 12 Apr 2016  路  6Comments  路  Source: python/typing

I know of:

  • pylint, which has plans to support PEP 484
  • mypy, which can type check PEP 484 programs, and uses PEP 484 on its own code
  • pytype, which can type check PEP 484 programs, and generate PEP 484 annotations

Which other static analysis tools have picked up PEP 484, and/or can do useful checking of (or anything else, with) annotated Python source?

question

Most helpful comment

How about the best dynamic checker of them all, Python itself? 100% accuracy in determining runtime type errors, with no annotations required whatsoever :)

There are _plenty_ of cases where Python will silently Do The Wrong Thing due to type errors.

One of the simple examples is if you end up calling iter('foo') rather than iter(['foo']).

All 6 comments

There's PyCharm, of course, which supports PEP 484 syntax (even the Python
2 variant, in PyCharm 5.1).

There's also this independent stub generator:
https://github.com/edreamleo/make-stub-files

I also found https://github.com/o11c/stubtool but I don't know if it's
still alive.

Don't ignore dynamic checking, which may help where static checking does not reach:

https://pypi.python.org/pypi/typecheck-decorator

Nice for instance for incremental sense-making when maintaining somebody else's code:

find out something, annotate it, run tests, and see whether it is indeed usually true.

Lutz

How about the best dynamic checker of them all, Python itself?
100% accuracy in determining runtime type errors, with no annotations
required whatsoever :)

Cheers,
Mark

How about the best dynamic checker of them all, Python itself? 100% accuracy in determining runtime type errors, with no annotations required whatsoever :)

There are _plenty_ of cases where Python will silently Do The Wrong Thing due to type errors.

One of the simple examples is if you end up calling iter('foo') rather than iter(['foo']).

Since someone already mentioned this, I could add another runtime type checking tool that I have seen: https://github.com/agronholm/typeguard

Closing as this is no longer relevant

Was this page helpful?
0 / 5 - 0 ratings