-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why doesn't mypy primer use a cache #29
Comments
Hello! Awesome to hear that! :-) Glad to have played a small part in helping make Python tooling great. Your understanding is correct: every time we run mypy_primer, we run things against the merge base and the commit to compare to. There's no great reason why we don't cache things across runs. While mypy_primer isn't fast, with sharding it's fast enough, so typeshed and mypy haven't really felt the pain (in particular, for mypy, unit tests are slower than sharded primer!) The nice thing about always recomputing results is that you don't have to worry about your caching logic doing something incorrect. I've found Github Actions a bit painful for testing this kind of thing, which doesn't increase my motivation to do this. That said, something I've wanted to do is cache project clones and venvs. This would be a win that doesn't cost sanity and mypy_primer already somewhat supports this locally, just not across CI runs (would need something like https://github.com/actions/cache ). |
Ah okay. That seems logical.
This is a worry I have myself 😄
Yeah, we have been looking at that as well. I guess for Thanks for your answers though! Much appreciated! Closing this 😄 |
@hauntsaninja We actually managed to implement something in This did prompt one further question though. I hope you don't mind me asking it here instead of opening a new issue. We use Is this something you are running into as well? And if so, have you considered any solutions to do this? _Before I spent a couple of hours diving into the Github documentation to see if there is any way to avoid this 😅 _ |
Oh you mean getting hidden by a Github fold? This happens every now and then, but hasn't been a problem for us in practice. I think this happens on PRs with a lot of activity and on those there are enough eyes and enough comment notifications that they end up getting seen. The only related adjustment we made was on typeshed. typeshed uses pre-commit.ci which makes quick follow up reformatting commits; we disabled mypy-primer from running on pre-commit commits to avoid noise (since pre-commit.ci won't change semantics). |
Yeah! I guess normally there will be a review comment in between primer runs, so the fold won't happy anyway. It's just when you push to your Github branch and then immediately re-push triggering another run. ... I'm going to add workflow concurrency now that I think about it. 😄
That's a good tip actually! Didn't think about that, but we should probably do the same. I'll have a look at how you set this up over at |
Hi,
Not sure if this is the best place to ask this question but we have implemented a
mypy
primer inspired primer forpylint
and I have also implemented one for my own project (https://github.com/DanielNoord/pydocstringformatter).Many thanks for the inspiration and this awesome tool. It helped us prevent a number of painful regressions for upcoming
pylint
releases.We are now looking to expand the functionality of the tool (pylint-dev/pylint#5364 if you are interested) and a question I previously had came up again. Is there a reason why the primer doesn't use some sort of cache for the result of the
main
branch? (Or am I missing something in the code?). It seems like the primer runs twice over themerge-base
commit and the commit of the PR. Can't the result ofmerge-base
be stored after a run of the CI onmain
and then re-used in all PRs?I didn't see this as something on the todo list and for us it seemed like low hanging fruit to improve the runtime of the CI so I (perhaps incorrectly) assumed it was considered and then rejected. Am I correct in assuming so? And if yes, could you elaborate a bit on the rationale?
If not, please consider this an issue about adding that to the todo list 😄
The text was updated successfully, but these errors were encountered: