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

Migrate tool configs to pyproject.toml, configure pre-commit.ci #342

Merged
merged 4 commits into from
Nov 9, 2023

Conversation

mfisher87
Copy link
Collaborator

@mfisher87 mfisher87 commented Nov 9, 2023

Pytest and Mypy can both be configured by pyproject.toml.

Flake8 can't, but Ruff can. I prefer Ruff anyway, so I opened #341.

Copy link

github-actions bot commented Nov 9, 2023

Binder 👈 Launch a binder notebook on this branch for commit 4ee9d86

I will automatically update this comment whenever this PR is modified

Binder 👈 Launch a binder notebook on this branch for commit 5253e92

Binder 👈 Launch a binder notebook on this branch for commit c64b1d6

Copy link
Collaborator

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @mfisher87! Overall the changes here look sensible to me. It looks like linting / testing didn't run here due to various restrictions we have in those GHA workflows. We should probably update those to include changes to more files. FWIW I would actually be okay always running linting and tests.

@@ -78,6 +78,21 @@ requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"


[tool.pytest]
filterwarnings = ["error::UserWarning"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I realize this is just moving an existing setting around, but I'm curious what this is actually doing. Maybe causing UserWarnings to be elevated to errors?

Copy link
Collaborator Author

@mfisher87 mfisher87 Nov 9, 2023

Choose a reason for hiding this comment

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

It's based on warnings.simplefilter it seems. Your speculation was spot on :)

As for "why", I'm not sure :)

@mfisher87
Copy link
Collaborator Author

mfisher87 commented Nov 9, 2023

It looks like linting / testing didn't run here due to various restrictions we have in those GHA workflows. We should probably update those to include changes to more files

Hm, yeah... good eye. I wonder when did this start happening? (EDIT: when someone opened a PR that doesn't change code or tests ;) )

It looks like we're not running pre-commit checks in CI at all? Maybe for another thread, but I've had a good user experience with and would like to use pre-commit.ci!

This prevents repo changes from desyncing with the actions config,
resulting in tests not running when we might expect them to.
Adjust YAML whitespace for consistency with our other YAML files
@jrbourbeau
Copy link
Collaborator

It looks like we're not running pre-commit checks in CI at all?

We're running linting as part of the test script here

pytest tests/unit --cov=earthaccess --cov=tests --cov-report=term-missing ${@} -s --tb=native --log-cli-level=INFO
bash ./scripts/lint.sh

But I agree, this isn't obvious at first

Maybe for another thread, but I've had a good user experience with and would like to use pre-commit.ci!

I'm also +1 for pre-commit (xref #282)

@mfisher87
Copy link
Collaborator Author

Ah, thanks! I expected that they would be run through pre-commit so didn't think to search for direct invocations. I'll continue the conversation about linter changes over there.

@mfisher87
Copy link
Collaborator Author

I updated our test workflow to remove path restrictions. Looking good now :)

Copy link
Collaborator

@jrbourbeau jrbourbeau left a comment

Choose a reason for hiding this comment

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

Thanks @mfisher87

Comment on lines +1 to +5
ci:
autoupdate_schedule: "monthly" # Like dependabot
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_prs: false # Comment "pre-commit.ci autofix" on a PR to trigger

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've not used pre-commit.ci before. I'm assuming this is correct and you'll handle whatever signup / authentication is needed to hook this repo into pre-commit.ci

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, need to flip a switch on my other GitHub account. It will be just a minute...

@MattF-NSIDC MattF-NSIDC changed the title Migrate tool configs to pyproject.toml Migrate tool configs to pyproject.toml, enable pre-commit.ci Nov 9, 2023
@MattF-NSIDC MattF-NSIDC changed the title Migrate tool configs to pyproject.toml, enable pre-commit.ci Migrate tool configs to pyproject.toml, configure pre-commit.ci Nov 9, 2023
@MattF-NSIDC
Copy link

MattF-NSIDC commented Nov 9, 2023

It's on. It may not be watching this PR yet, but let's try...

pre-commit.ci run

EDIT: There goes :)

@MattF-NSIDC
Copy link

Let's call fixes out of scope. New PR incoming.

@MattF-NSIDC MattF-NSIDC merged commit 54399ff into nsidc:main Nov 9, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants