CI: mypy hangs
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
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 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.
Please find the Issue here. And It is an native issue with mypy handling numpy in run time. This Might be a cause .
@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.
The issue is happening at build time, in both the PRs @orbeckst linked - this is some kind of dependency resolution issue.
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.
@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.
@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.
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.