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

Include GitHub Actions #98

Merged
merged 23 commits into from
May 17, 2024
Merged

Include GitHub Actions #98

merged 23 commits into from
May 17, 2024

Conversation

TeaganKing
Copy link
Collaborator

@TeaganKing TeaganKing commented May 9, 2024

Closes #97
This PR uses some of the pre-commit-hooks from this repository and an updated workflow from here.

@TeaganKing TeaganKing self-assigned this May 9, 2024
@TeaganKing
Copy link
Collaborator Author

List of checks that failed: trim trailing whitespace, fix end of files, fix double quoted strings, black-jupyter, reorder python imports, add trailing commas, pyupgrade, autopep8, flake8

List of checks that passed: check yaml, debug statements (python), check docstring is first, check json

We may want to review which checks we actually want to run and make an additional issue to resolve the failing checks?

@TeaganKing
Copy link
Collaborator Author

Ok pre-commits are now working properly and conflicts between black-jupyter and autopep8, as well as the double vs single quotes, are resolved (thanks to some suggestions from Anissa on the former!)

Anyways, this should be ready for review now.

Copy link
Collaborator

@mnlevy1981 mnlevy1981 left a comment

Choose a reason for hiding this comment

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

I'm not sure of the best place for it (maybe the README for now, but eventually in a "developer's guide" type page?), but we should include instructions on how to enable pre-commit locally. I think we want to add it to cupid-dev, and then recommend using that environment when committing changes. The real power of the package is that it will warn you when you try to commit changes that violate the style guide; using it in Github Actions is more of a backup plan than anything else.

Other than that (and my confusion around annotate), this all looks great! Little is as satisfying as seeing a whole bunch of trailing whitespace get removed :)

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
import os
import sys
from __future__ import annotations
Copy link
Collaborator

Choose a reason for hiding this comment

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

It doesn't look like annotations is used anywhere; was this requested by something in the CI testing?

@@ -1,92 +1,100 @@
from __future__ import annotations
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment; I assume it's getting added by the CI but I don't understand why

@TeaganKing
Copy link
Collaborator Author

TeaganKing commented May 17, 2024

I added a note on running pre-commit run to our contributor's guide. If you prefer this goes in the readme, I could add it there too, but it seems to fit better in the wiki page (although perhaps it is a little hidden).

I think the from __future__ import annotations is needed for checking imports with reorder-python-imports, which is a bit annoying. The purpose is that it stores type annotations as strings, delaying their evaluation. Of course this is not really used in some of the essentially empty files, but I would prefer all the tests pass.

Copy link
Collaborator

@mnlevy1981 mnlevy1981 left a comment

Choose a reason for hiding this comment

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

I added a note on running pre-commit run to our contributor's guide. If you prefer this goes in the readme, I could add it there too, but it seems to fit better in the wiki page (although perhaps it is a little hidden).

The contributor guide is a great place for it! I didn't think to look there, and the wiki files don't show up as changed in the PR :) I'll come back this afternoon with a small update (adding precommit to environments/dev-environment.yml and giving more explicit instructions in the wiki about setting it up to run with every git commit) but I'll merge this now

@mnlevy1981 mnlevy1981 merged commit b402eba into NCAR:main May 17, 2024
1 check passed
@TeaganKing
Copy link
Collaborator Author

Sounds great! Thanks for reviewing and merging this, Mike!

@TeaganKing TeaganKing deleted the actions branch July 3, 2024 20:27
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.

Add GitHub Actions
2 participants