Surprisingly long CI (github-actions) mypy execution time
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 20.6k
- Forks
- 3.3k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Hey folks,
I guess this is a wrong place to post it, though at this point I kinda feel helpless and I won't get any substantial insights on StackOverflow. What's the story then? I've started working on some kaggle project with a friend using a fresh repo. We use mypy in our CI build pipeline. At some point github actions started reporting really long execution times on mypy step. Running mypy locally takes barely seconds as it's still very small repo. Let me show you one of them:

mypy takes almost 2 minutes for just a few files in a repo. Setting up python 3.10 takes considerable time, but it's mostly recovering poetry cache with some heavy libraries. That's ok. At first I thought we might have some problems using --install-types flag but that's not a case. I went throught the CI history and found out that mypy execution time went up, once we added pytorch to the project's dependencies. I guess mypy is running some type resolution/discovery stuff for used dependencies. Is there any way to cache it in a remote CI setting to reduce the execution times?
repo: https://github.com/piotr-rarus/kaggle-rsna-breast-cancer
build workflow: https://github.com/piotr-rarus/kaggle-rsna-breast-cancer/blob/main/.github/workflows/build.yml
- name: Mypy
run: |
poetry run mypy --incremental --show-error-codes --pretty src
All relevant env info is stated in the repo's toml. Dependencies are managed using poetry and pinned down in poetry.lock: https://github.com/piotr-rarus/kaggle-rsna-breast-cancer/blob/main/pyproject.toml
By no means I expect to get a fix, that's not a bug. Some substantial insights into proper CI mypy usage would be most welcome :)
Take care, you're my favourite python's lib.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit .github/workflows/build.yml und pyproject.toml und vergleiche anschließend den mypy-Schritt des Workflows mit der Abhängigkeits- und Cache-Konfiguration des Repositorys. Untersuche den gemeldeten Anstieg der Laufzeit nach dem Hinzufügen von pytorch und ermittle, ob das Ergebnis eine dokumentierte Empfehlung zur CI-Nutzung oder zum Caching stützt; das Issue ist abgeschlossen, wenn diese Anleitung eindeutig festgehalten oder die Frage geklärt ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- github-actions, python, pytorch
- Bereich
- ci-cd, tooling
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100