8000 Add pre-commit by NMertsch · Pull Request #219 · EuroPython/discord · GitHub
[go: up one dir, main page]

Skip to content

Add pre-commit #219

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

Merged
merged 16 commits into from
May 11, 2025
Merged

Conversation

NMertsch
Copy link
Contributor
@NMertsch NMertsch commented May 10, 2025

Summary

Bundle all code checks with pre-commit.

Fixes #148

Added pre-commit checks

built-in hooks:

  • Ensure trailing newlines
  • Remove trailing whitespace
  • Check toml and yaml syntax
  • Prevent addition of large files (>500 KB)

uv:

  • Check if uv.lock is up to date

ruff:

  • Fix import and code formatting
  • Run ruff check

custom:

  • Run pytest

Other changes

  • Replace lint and test CI workflows with a single pre-commit invocation to avoid configuration drift
  • Set explicit workflow permissions (following a GitHub security warning)
  • Update package versions
  • Update documentation
  • Fix pre-commit findings (add trailing newlines, remove trailing whitespace)

@NMertsch NMertsch linked an issue May 10, 2025 that may be closed by this pull request
4 tasks
@NMertsch NMertsch changed the title Add pre-commit Draft: Add pre-commit May 10, 2025
@NMertsch NMertsch marked this pull request as draft May 10, 2025 23:41
@NMertsch NMertsch changed the title Draft: Add pre-commit Add pre-commit May 10, 2025
@NMertsch
Copy link
Contributor Author

pre-commit.ci run

@NMertsch NMertsch requested a review from egeakman May 11, 2025 00:13
@NMertsch
Copy link
Contributor Author

@egeakman I hope this is what you imagined. I tried pre-commit.ci, but removed it again for these reasons:

  • pre-commit.ci cannot run pytest, so it would require separate local and CI configurations.
  • I consider server-side code modifications an accessibility issue. For beginners, git is already complex enough without merge conflicts induced by post-push modifications.

@NMertsch NMertsch marked this pull request as ready for review May 11, 2025 00:27
@egeakman
Copy link
Member

Hey Niklas! Thanks for the PR; it looks great overall!

If I understand correctly, this checks whether uv.lock is up to date and updates it if it's not. Since Dependabot already manages updates to uv.lock, I'd prefer to avoid making manual or local changes, assuming we trust our tests to catch any issues.

Dependabot is responsible for this task
@NMertsch
Copy link
Contributor Author

Thank you Ege, that's a valid point. Fixed in ff112e4.

@NMertsch NMertsch merged commit d6410f0 into main May 11, 2025
4 checks passed
@NMertsch NMertsch deleted the 148-developer-environment-improvements-pre-commit branch May 11, 2025 10:29
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.

Developer Environment Improvements
2 participants
0