mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

CI: mypy hangs

Open orbeckst opened this issue 3 months ago • 5 comments

Expected behavior

All CI completes.

Actual behavior

The mypy job has been hanging on multiple PRs.

Code to reproduce the behavior

See eg

  • PR #5165 : https://github.com/MDAnalysis/mdanalysis/actions/runs/19959384724/job/57937001578
  • PR #5176 : https://github.com/MDAnalysis/mdanalysis/actions/runs/20177519400/job/57929297433?pr=5176

orbeckst avatar Dec 12 '25 21:12 orbeckst

Possible Issue: NumPy 2.0.x was recently released with major changes to its type stubs (numpy.typing). Current versions of mypy can get stuck in an infinite loop or take an excessive amount of time when trying to resolve these new definitions, causing GitHub Actions to time out. Workable solution: I think clipping the mypy requirements to be 1.x numpy version or any possible stable numpy in the runtime until this is refactored in the numpy version.It can be changed in the present code here

minowau avatar Dec 13 '25 00:12 minowau

@minowau can you possibly link to where you got this information from? From a brief look I haven't been able to find any bug reports that match this.

IAlibay avatar Dec 13 '25 05:12 IAlibay

Please find the Issue here. And It is an native issue with mypy handling numpy in run time. This Might be a cause .

minowau avatar Dec 13 '25 08:12 minowau

@minowau thanks, however the issue only happened recently and we've been using numpy 2+ for a while, I don't think that is the current issue.

IAlibay avatar Dec 13 '25 09:12 IAlibay

The issue is happening at build time, in both the PRs @orbeckst linked - this is some kind of dependency resolution issue.

IAlibay avatar Dec 13 '25 09:12 IAlibay

Hey Team , I have seen that the mypy has been being timeout for all PR's So i just Increased the timeout to a 30min to refactor I have found these results please go through the Screenshots.

Main Issue:

It was taking for around 21 mins for installing dependencies that might be the main issue. The full report I could provide in coming days.

This was just my observation hope it helps.

Image

minowau avatar Dec 18 '25 14:12 minowau

@orbeckst @IAlibay Update I have resolved the timeout issue by increasing timeout from 10 mins to 30 mins at this Code file

Previous code

mypy : if: "github.repository == 'MDAnalysis/mdanalysis'" runs-on: ubuntu-latest timeout-minutes: 10 ..

Updated Code

mypy : if: "github.repository == 'MDAnalysis/mdanalysis'" runs-on: ubuntu-latest timeout-minutes: 30 .. This is resolving the issue. For long terms we can cache the dependencies so we could reduce the check time and make it faster. Hope it helps.

Image

minowau avatar Dec 18 '25 14:12 minowau

@minowau increasing the timeout time isn't an ideal solution here - we unfortunately haven't had time to really dig into this yet, I'll try to spend time on it over the holidays.

IAlibay avatar Dec 18 '25 18:12 IAlibay

I understand that, I have gone through the previous pr’s and mainly the mypy was hanging for PR’s from october 15. So I was dissecting what were the changes. And the best I found was using a cache based downloading but I am still finding how we could do that . So the timeout was introduced as a temporary step, And let me know if you have any idea so that I could also just go through that and learn how this issue could be solved. And thank you for replying @IAlibay Hope this could be something useful.

minowau avatar Dec 18 '25 19:12 minowau