I’ve got an issue when migrating from mypy to pyri...
# general
r
I’ve got an issue when migrating from mypy to pyright when running
pants check ::
as part of a GitHub action. Sometimes (but not always) pyright fails the check, it looks like its failing to find any of the 3rd part imports with lots of errors such as (file path redacted):
Copy code
/tmp/pants-sandbox-zZouYc/.../models.py
  /tmp/pants-sandbox-zZouYc/.../models.py:7:6 - error: Import "pydantic" could not be resolved (reportMissingImports)
There are hundreds of these errors, seemingly for every third party import, any idea on how to start debugging this or how to resolve it?
Seems like it might be similar to https://pantsbuild.slack.com/archives/C046T6T9U/p1687366638498259 although we aren’t using a remote cache but are using the init pants github action with the following settings, not sure if this is useful information:
Copy code
- name: Initialise Pants
        uses: pantsbuild/actions/init-pants@v4-scie-pants
        with:
          gha-cache-key: cache0-py3.10
          named-caches-hash: ${{ hashFiles('3rdparty/python/default.lock') }}
          cache-lmdb-store: "true"
b
My issue turned out to be entirely related to remote caching, so I don’t think that’s what’s going on for you. But I wonder if using a newer version of the init action would help. Here is my CI code for caching (you’ll have to forgive the American spelling):
Copy code
- name: Initialize Pants
      uses: pantsbuild/actions/init-pants@v5-scie-pants
      with:
        gha-cache-key: cache1-py3.10
        named-caches-hash: ${{ hashFiles('3rdparty/python/*.lock') }}
You could try changing the cache key as well, and seeing if busting the cache entirely helps
r
Thanks, I’ll definitely give it a go, I didn’t realise there was a new version of the action
Unfortunately this didn’t resolve the issue, hitting up against it again
b
What ended up being the issue for me with the remote cache was cache corruption; for you, I’m not sure if the issue is the same but you could try disabling the LMDB store by removing
cache-lmdb-store: "true"
from the options
r
Thanks, I’ll give it a go and report back
As promised, reporting back, so far this seems to have fixed the issue, there has been conversation on the issue I logged on GitHub too that talks about the cause if you’re interested: https://github.com/pantsbuild/pants/issues/19368