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

optimise pre-commit #4208

Merged
merged 1 commit into from
Jun 24, 2021
Merged

optimise pre-commit #4208

merged 1 commit into from
Jun 24, 2021

Conversation

bjlittle
Copy link
Member

@bjlittle bjlittle commented Jun 23, 2021

🚀 Pull Request

Description

This PR plays to the strengths of pre-commit and filters files at the right level before running the hooks.

This configuration works for local developer commits on only the files that have changed (optimisation), and for cirrus-ci when pre-commit hooks are run against all files. In addition, the behaviour of the tools which the hooks call still honour their specific configuration.

This undoes a major regression introduced in #4181. Oops 😊


Consult Iris pull request check list

pyproject.toml Show resolved Hide resolved
Copy link
Member

@pp-mo pp-mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I think I get this now.
And I can confirm that the speedup seems to be working for me, including ignoring the nox directories, which before it was also not doing.

@pp-mo pp-mo merged commit 9a06485 into SciTools:main Jun 24, 2021
@trexfeathers
Copy link
Contributor

Nice work @bjlittle !

@bjlittle bjlittle deleted the pre-commit-filter branch July 1, 2021 11:39
tkknight added a commit to tkknight/iris that referenced this pull request Jul 21, 2021
* main: (43 commits)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4244)
  Updated environment lockfiles (SciTools#4242)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4239)
  Documented the --force option on conda env create (SciTools#4240)
  Updated environment lockfiles (SciTools#4237)
  pre-commit isort and black --check only for cirrus-ci (SciTools#4235)
  Only run docs-building sessions with Python 3.8. (SciTools#4210)
  consolidate cirrus-ci documentation tasks (SciTools#4219)
  Updated environment lockfiles (SciTools#4223)
  Replace pyke nopyke (SciTools#4198)
  drop cirrus-ci minimal tests (SciTools#4218)
  remove change management tech paper (SciTools#4217)
  [pre-commit.ci] pre-commit autoupdate (SciTools#4213)
  Updated environment lockfiles (SciTools#4212)
  Widen cube printout for long ancil or cell-measure names. (SciTools#4124)
  convert docs print statements (SciTools#4209)
  optimise pre-commit (SciTools#4208)
  drop black and flake8 dependencies (SciTools#4181)
  pre-commit blacked docs (SciTools#4205)
  pre-commit update (SciTools#4204)
  ...
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.

3 participants