-
-
Notifications
You must be signed in to change notification settings - Fork 117
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
python3 setup.py lint
is deprecated: Let's lint with pre-commit
#2772
python3 setup.py lint
is deprecated: Let's lint with pre-commit
#2772
Conversation
python3 setup.py list
is deprecated: Let's format and lint with pre-commit
python3 setup.py list
is deprecated: Let's format and lint with pre-commit
python3 setup.py list
is deprecated: Let's lint with pre-commit
248cf01
to
c5d94f4
Compare
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.
Our middle term goal is to move away from the current setup.py
based buildconfig entirely (ref: #2557)
I think this PR is a step in the right direction, thanks!
python3 setup.py list
is deprecated: Let's lint with pre-commit
python3 setup.py lint
is deprecated: Let's lint with pre-commit
@ankith26 @Starbuck5 @oddbookworm Your reviews, please. |
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.
Thanks for contributing! 🎉
I have tested this PR locally by deliberately making bad formatting changes. Both hooks ran correctly and fixed formatting. It also aborted the commit, but I think that's expected behaviour, one has to attempt another commit after a failed pre commit hook?
So the pre-commit hooks are all good.
I am still not clear how the action works exactly, but I'd like to merge this PR anyways and then look into the results
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.
LGTM!
^src_c/_sdl2/.*$ | ||
| ^src_c/doc/.*$ | ||
| docs/reST/_static/script.js | ||
| docs/reST/_templates/header.h | ||
| src_c/include/sse2neon.h | ||
| src_c/pypm.c |
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.
For future reference if/when these want to be removed, I'm leaving some rationale for keeping them excluded:
src_c/_sdl2
is autogenerated from cython, we shouldn't block merges based on the linting of autogen code
src_c/doc
is the same story, it's autogenerated from docs generation
src_c/include/sse2neon.h
is a header that we're vendoring in, I'm not sure we need to lint it because it's from a 3rd party
src_c/pypm.c
is autogenerated from cython
docs/reST/_templates/header.h
is the template for the src_c/doc
generated files and isn't a valid C header file itself, so using a C linter would probably cause a black hole or something, I dunno
docs/reST/_static/script.js
I dunno about this one, something something sphinx, maybe someone else can enlighten me on this file
Running
python3 setup.py lint
is deprecated. https://packaging.python.org/en/latest/discussions/setup-py-deprecatedThe
setup.py
logic for runningblack
andclang-format
is ~100 lines long and is skipping many Python and C files.pygame-ce/setup.py
Lines 786 to 875 in 65a256d
This pull request proposes using
pre-commit
with ~25 lines of configuration to rapidly run these two tools locally on contributors' machines and also in our GitHub Actions to cover any contributors who do not havepre-commit
installed.The 15
exclude
lines should be removed gradually as more of the codebase passes the formatting and linting process.How to use: