Closed mristin closed 2 years ago
Type hints in the package have only just been released, it's been a bit bumpy.
@palfrey any idea what might cause this?
This appears to be an issue with the strict flag, and mypy --strict --implicit-reexport deleteme.py
works. See https://stackoverflow.com/questions/60734086/mypy-gives-an-error-while-importing-submodule-module-has-no-attribute and https://github.com/python/mypy/issues/7030
It's fixable in the source code, and I'll have a look at that now.
Released 2.0.8 with the fix.
Hi! I updated to the latest version of asttokens 2.0.7 on my package icontract during a CI run, and the mypy started complaining that
asttokenst.ASTTokens
is missing.Please see this error: https://github.com/Parquery/icontract/runs/7819826733?check_suite_focus=true
Here's a relevant excerpt:
I fixed the issue by importing
asttokens.asttokens
and writing outasttokens.asttokens.ASTTokens
instead of importingasttokens
and usingasttokens.ASTTokens
. Please see this pull request: https://github.com/Parquery/icontract/pull/252I tried to figure out what caused this mypy error. Honestly, I couldn't really understand where the culprit is. I installed the latest mypy version (0.971) and that didn't help either. I see that you haven't changed
asttokens/__init__.py
in 6 years so that can't be a reason either.Here is a minimal code snippet if you want to reproduce the issue (I called the file
deleteme.py
):Then, after installing mypy==0.971 and asttokens==2.0.7, run:
I get the error message: