mypy error. Probably this is the worst to ask this...
# general
p
mypy error. Probably this is the worst to ask this question as everyone will be off for the weekend, but here it goes anyway. I am running
pants check ::
and I can see the most bizarre behaviour. It is running against code that is under `~/.cache`:
Copy code
17:23:27.08 [ERROR] Completed: Typecheck using MyPy - mypy - mypy failed (exit code 1).
/Users/hwasunglee/.cache/pants/named_caches/pex_root/venvs/b6931bdae8f8b96dc1667880821ad38804708c39/61e31f7f20e144a11daf2c769c9d0900c3179016/lib/python3.9/site-packages/streamlit/connections/sql_connection.py:18:1: error: disable_error_code: Invalid error code(s): import-not-found  [misc]
Why is pants running
mypy
against code under
~/.cache
? I ignore 3rd party stuff in my `mypy.ini`:
Copy code
[mypy]
error_summary = True
ignore_missing_imports = True
pretty = True
show_absolute_path = True
show_column_numbers = True
strict = True
Perhaps a bug?
The current workaround I have is to upgrade
mypy
using lockfiles if anyone encounters this error.
c
I think that's indicating that mypy is being run against the 3rdparty code in a venv, potentially a venv for one of the tools that Pants runs. If you run it with
--keep-sandboxes=always
, it'll keep the sandbox open. you could then inspect the command invocation or see what symlinks into that file. You could also try deleting the Pants cache and seeing if it persists.
p
Yeah, actually I did delete the Pants cache but this persists. I just updated the
mypy
; I know it is still doing the check underneath but it works for now...
a
I'm also running into this weird mypy behavior while writing a custom pants plugin. @microscopic-knife-5995 did you solve it by updating mypy? Which version are you using to get around this?
m
Yes, I upgraded
mypy
I am currently using 1.14.x series...
gratitude thank you 1