Skip to content
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

Make pre-commit super fast via caching + avoiding updating miniconda #1153

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dbast
Copy link
Contributor

@dbast dbast commented Feb 6, 2025

pre-commit spends most of its time setting up the hooks (=cloning their repos and installing each hook into its own virtual env).

Caching helps to give faster feedback (~30 secs vs 73 secs before) on new PRs. And it protects against rate limit issues in situations of many fast PR updates as every hook is a repo that is cloned. The cache invalidates when the python version, pre-commit version or pre-commit config changes.

Also avoiding the setup-miniconda action as that anyways uses the miniconda already present on the runners to save time.

Also adding black hook to pre-commit and limit to buildscripts.

Note: This uses https://github.com/psf/black-pre-commit-mirror and not https://github.com/psf/black to avoid cloning the entire black repo (=faster).

@dbast dbast force-pushed the black branch 4 times, most recently from 2aa0808 to 4a00765 Compare February 6, 2025 14:27
pre-commit spends most of its time setting up the hooks (=cloning their
repos and installing each hook into its own virtual env).

Caching helps to give almost instant feedback on new PRs. The cache
invalidates when the python version, pre-commit version or pre-commit
config changes.

Also avoiding the setup-miniconda action as that anyways uses the miniconda
already present on the runners to save time.

Also adding black hook to pre-commit and limit to buildscripts.

Note: This uses https://github.com/psf/black-pre-commit-mirror and not
https://github.com/psf/black to avoid cloning the entire black repo
(=faster).
@dbast dbast marked this pull request as ready for review February 6, 2025 14:35
@kc611 kc611 requested a review from esc February 11, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants