Skip to content

Update pre-commit - #56

Closed
forsyth2 wants to merge 3 commits into
mainfrom
update-pre-commit
Closed

Update pre-commit#56
forsyth2 wants to merge 3 commits into
mainfrom
update-pre-commit

Conversation

@forsyth2

Copy link
Copy Markdown
Collaborator

Summary

Objectives:

  • Update pre-commit dependencies based on running pre-commit autoupdate

Issue resolution:

  • Closes Dependabot note to update pre-commit versions.

Select one: This pull request is...

  • a bug fix: increment the patch version
  • a small improvement: increment the minor version
  • a new feature: increment the minor version
  • an incompatible (non-backwards compatible) API change: increment the major version

Small Change

  • To merge, I will use "Squash and merge". That is, this change should be a single commit.
  • Logic: I have visually inspected the entire pull request myself.
  • Pre-commit checks: All the pre-commits checks have passed.

@forsyth2 forsyth2 self-assigned this Aug 13, 2026
@forsyth2 forsyth2 added the DevOps CI/CD, configuration, etc. label Aug 13, 2026
@forsyth2
forsyth2 requested a lite review from Copilot August 13, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_stages to [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 and pyproject.toml’s qa extra.
  - 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.

Comment thread conda/dev.yml
Comment thread .pre-commit-config.yaml
- Address Copilot review comments
- Address failing build caused by isort not on conda-forge

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.yaml says tool versions should match conda/dev.yml and pyproject.toml, but isort is updated here to rev: 9.0.0b2 while the other files still pin isort==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 qa extra is supposed to match conda/dev.yml and .pre-commit-config.yaml, but mypy is still pinned to 1.18.2 while the other files use 2.3.0, and pre-commit was 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 forsyth2 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@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!

Comment thread .pre-commit-config.yaml
@@ -1,11 +1,11 @@
exclude: "docs|node_modules|migrations|.git|.tox"
default_stages: [commit]
default_stages: [pre-commit]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread .pre-commit-config.yaml
# Can run individually with `pre-commit run isort --all-files`
- repo: https://github.com/PyCQA/isort
rev: 6.0.1
rev: 9.0.0b2

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The build workflow doesn't work if it's set to 6.0.1 elsewhere.

@xylar xylar Aug 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @xylar!

@xylar xylar Aug 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I will add it here (on zppy-interfaces) and you can add it elsewhere if you like it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That'd be great, thanks again!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
rev: 9.0.0b2
rev: 8.0.1

8.0.1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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: 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.

@forsyth2 forsyth2 added the semver: bug Bug fix (will increment patch version) label Aug 13, 2026
@forsyth2

Copy link
Copy Markdown
Collaborator Author

@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.

@xylar xylar mentioned this pull request Aug 13, 2026
7 tasks
@forsyth2

Copy link
Copy Markdown
Collaborator Author

@xylar Would you recommend just merging this PR now, then merge #57, and then check if anything new comes up based on what that shows?

@xylar

xylar commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

No, I would downgrade pre-commit to whatever the latest non-beta version is first, then you can merge this, then #57. Or we could merge #57 instead of this and it will generate a PR exactly like this but without the beta version.

@forsyth2

Copy link
Copy Markdown
Collaborator Author

Or we could merge #57 instead of this and it will generate a PR exactly like this but without the beta version.

@xylar Ok, that seems to be the most straight-forward option; I think we should just do that. I'll merge #57.

@forsyth2

Copy link
Copy Markdown
Collaborator Author

Replaced by #58.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DevOps CI/CD, configuration, etc. semver: bug Bug fix (will increment patch version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants