Update pre-commit - #56
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s pre-commit toolchain pins (via pre-commit autoupdate) so local QA tooling and pre-commit hooks run newer formatter/linter/type-checker versions.
Changes:
- Bumped pinned QA tool versions in the conda dev environment (black/isort/mypy).
- Updated pre-commit hook revisions and switched
default_stagesto[pre-commit].
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
conda/dev.yml |
Updates pinned QA tool versions used in the dev conda environment. |
.pre-commit-config.yaml |
Updates hook revs and adjusts the default pre-commit stage. |
Suppressed comments (2)
conda/dev.yml:46
- isort is pinned to
9.0.0b2, which is a pre-release (beta). If you don’t explicitly want to test isort 9.x, pin to the latest stable release instead to reduce churn and risk of formatter/import-order changes across contributors and CI.
- isort ==9.0.0b2
.pre-commit-config.yaml:23
- isort is pinned to
9.0.0b2, which is a beta pre-release. If stability is preferred, use the latest stable isort release and keep the pin consistent with conda/dev.yml andpyproject.toml’sqaextra.
- repo: https://github.com/PyCQA/isort
rev: 9.0.0b2
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Address Copilot review comments - Address failing build caused by isort not on conda-forge
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (2)
.pre-commit-config.yaml:24
.pre-commit-config.yamlsays tool versions should matchconda/dev.ymlandpyproject.toml, butisortis updated here torev: 9.0.0b2while the other files still pinisort==6.0.1. This mismatch can cause different formatting/import-order behavior depending on how the tools are installed/run.
# Can run individually with `pre-commit run isort --all-files`
- repo: https://github.com/PyCQA/isort
rev: 9.0.0b2
hooks:
pyproject.toml:55
- The
qaextra is supposed to matchconda/dev.ymland.pre-commit-config.yaml, butmypyis still pinned to 1.18.2 while the other files use 2.3.0, andpre-commitwas changed to 2.3.0 (a downgrade) while conda pins 4.3.0. This will make QA environments inconsistent and may break hook execution.
"isort==6.0.1",
"mypy==1.18.2",
"pre-commit==2.3.0",
"types-PyYAML >=6.0.0",
forsyth2
left a comment
There was a problem hiding this comment.
@tomvothecoder I was going to rely on the Copilot review, but unfortunately I still have some open questions. Would you mind reviewing this PR and answering my questions? Thanks!
| @@ -1,11 +1,11 @@ | |||
| exclude: "docs|node_modules|migrations|.git|.tox" | |||
| default_stages: [commit] | |||
| default_stages: [pre-commit] | |||
There was a problem hiding this comment.
Everything in this file was changed automatically after running pre-commit autoupdate, so I assume everything is correct here. That said, do you know why the default_stages name changes here?
There was a problem hiding this comment.
I remember seeing a warning that commit was deprecated in favor of pre-commit. Not sure why, maybe because pre-commit is the more accurate term since it runs before the commit goes through.
| # Can run individually with `pre-commit run isort --all-files` | ||
| - repo: https://github.com/PyCQA/isort | ||
| rev: 6.0.1 | ||
| rev: 9.0.0b2 |
There was a problem hiding this comment.
pre-commit autoupdate wants this to be 9.0.0b2 but apparently that's not on conda-forge, so I left conda/dev.yml and pyproject.toml as using 6.0.1 for isort. Is that the correct course of action?
There was a problem hiding this comment.
The build workflow doesn't work if it's set to 6.0.1 elsewhere.
There was a problem hiding this comment.
This is an known issue with pre-commit autoupdate. We switched to pre-commit-update, a separate tool, in our auto-update workflow to avoid this issue:
https://github.com/E3SM-Project/polaris/blob/main/.github/workflows/pre_commit_update_workflow.yml
We run this workflow automatically once a month to get the latest pre-commit. I would recommend adding it to all your repos.
There was a problem hiding this comment.
I will add it here (on zppy-interfaces) and you can add it elsewhere if you like it.
There was a problem hiding this comment.
That'd be great, thanks again!
There was a problem hiding this comment.
| rev: 9.0.0b2 | |
| rev: 8.0.1 |
There was a problem hiding this comment.
This is an known issue with
pre-commit autoupdate. We switched topre-commit-update, a separate tool, in our auto-update workflow to avoid this issue: E3SM-Project/polaris@main/.github/workflows/pre_commit_update_workflow.yml We run this workflow automatically once a month to get the latest pre-commit. I would recommend adding it to all your repos.
This is a good idea for all of the other e3sm tools repos. I will take note. Thanks Xylar.
|
@rljacob This PR (along with related PRs for other repos: E3SM-Project/zppy#851, E3SM-Project/zstash#453, E3SM-Project/e3sm-comms#7) addresses the Dependabot issue. |
|
Replaced by #58. |
Summary
Objectives:
pre-commit autoupdateIssue resolution:
Select one: This pull request is...
Small Change