pythonmypypython-attrs

mypy doesn't recognize the latest version of attrs?


Is some special setup needed to help mypy recognize standard attrs usage?

somefile.py:7: error: Cannot find implementation or library stub for module named "attr"  [import-not-found]

(followed by a bunch on errors due to mypy unable to understand the structure of the attrs class)

Here is the relavent output of pip list

attrs                      23.1.0
mypy                       1.7.1
mypy-extensions            1.0.0
types-attrs                19.1.0
typing_extensions          4.5.0

Solution

  • MyPy is shipping an attrs plugin and attrs ships it own type stubs forever. So, pretty sure it’s the types-attrs package that is confusing it (note, that the latest version is from 2019), try uninstalling it.