-
Notifications
You must be signed in to change notification settings - Fork 15
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
Update pre-commit dependencies #627
Conversation
# https://pre-commit.ci/#configuration | ||
ci: | ||
autofix_prs: false | ||
autoupdate_schedule: monthly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll note that we don't really know if this will do anything useful. It is discussed on the web as a potential equivalent of dependabot for pre-commit but I suspect we may need to do something more than add this chunk of code to get it to actually run.
@altheaden, looks good! @forsyth2, I don't have permission to approve the workflow to let CI run. Could you do that? |
Thanks @forsyth2. It looks like you all have things configure to lint all files, not just the ones changed in a given PR. You might want to change that unless you want folks to have to clean up the mess that other folks left. Here's the bit that does that in mache: @forsyth2, is that also a change you'd like to have. If so, I think @altheaden would also be willing to do a PR for that, right @altheaden? |
Maybe in combination with |
I'm happy to either help out with implementing the change @xylar suggested or to help clean up the formatting of any older files, whichever would be more helpful. |
Personally, I don't really have a problem with linting all files. Checking all files means the entire repo meets our pre-commit checks. And if for some reason, a |
@forsyth2, okay. How do you want to handle the lint getting flagged here? Fix it in this PR or open a separate one? |
I don't understand how this is happening. On the latest
https://github.com/E3SM-Project/zppy/actions/runs/11150511889/job/30992064405?pr=627 shows:
Were these automated reformattings launched because of the pre-commit changes in this PR? In that case, it would make sense to include the formatting changes as part of this PR. If not, then I'm not really sure why there would be pre-commit formatting differences |
I wonder if some default behavior in |
I agree with @altheaden that the update in black is the most likely reason. Let's include the linting changes in this PR. They do look more correct. |
@xylar @forsyth2 I've updated the formatting, some of which was automatic via pre-commit and some of which was manual. The manual changes I made were to change statements of the form: type(<obj>) == <type> to: isinstance(<obj>, <type>) which was one of two possible fixes suggested by The alternative fix suggested by Without understanding the whole context of the code, I am not sure if these changes are desired or not. If we want to ignore inheritance and check only the two types directly, then I can revert these changes and set These changes will definitely need to be tested and I'm not totally sure how to do that for zppy. I looked through the documentation but I'm not certain what I should use for the config file if I'm going to be testing these changes specifically. |
We did run into an issue with |
Some resources:
I usually run what I call I can do that for this PR after I get the current tests passing again (#625).
For changes in the yml files, I take extra care to create a new conda environment from the updated yml, and then use that environment for integration testing. |
@forsyth2 I think the reason CI failed for this second run is because the pre-commit job is timing out in the caching step - once #621 gets merged this timeout is upped to 5 mins to avoid this problem. I think if you re-run it again it'll be faster due to caching and be able to complete, that's been my experience with the same issue in other repos. |
@altheaden yep looks like it passes now! |
e72987b
to
a51708f
Compare
Just updated this to a slightly newer version of these dependencies than when I initially made this PR. I also added changes to the versions in @tomvothecoder since you mentioned this file to me on Slack, do you mind taking a look at my updates to |
a51708f
to
d2b7525
Compare
d2b7525
to
4d0d985
Compare
@forsyth2 Just rebased this branch onto main and fixed the merge conflicts, so it's ready to move forward into testing whenever. |
Looks good to me. Thank you @altheaden. |
@forsyth2 looks like CI passed for everything other than pre-commit timing out at the caching step again. |
@forsyth2 and @altheaden, thanks again! |
Hmm, @altheaden after merging this, I'm getting this error over on #623 after trying to run our pre-commit checks.
Is there a different command now? |
@forsyth2, maybe try removing |
I just successfully ran:
As expected, I see:
|
(It looks like there are 2 deprecation warnings to fix still.) |
Ah, of course. That completely slipped my mind, thanks. It's working now with a dev environment built off the latest
Yes, I'm seeing that too. |
* Update pre-commit dependencies * Update pre-commit deps in `conda/dev.yml` * Fix `black` formatting errors * Fix `flake8` programming errors
This PR updates the dependencies within
.pre-commit-config.yaml
to their most recent versions. It also adds pre-commit CI which will hopefully auto-update these dependencies on a monthly basis.Updated template from @forsyth2:
Issue resolution
This pull request is a minor adjustment that does not affect functional code.
1. Does this do what we want it to do?
Objectives:
.pre-commit-config.yaml
to their most recent versions.Required:
type() ==
toisinstance
. These changes are unlikely to create errors as noted in Update pre-commit dependencies #627 (comment). In any case, the unit tests are passing and the weekly integration tests will be run onmain
after merging.2. Are the implementation details accurate & efficient?
Required:
3. Is this well documented?
Required:
4. Is this code clean?
Required: