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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pep-lint.py
#3275
base: main
Are you sure you want to change the base?
Add pep-lint.py
#3275
Conversation
|
LGTM. From my testing, it appears that this may place a minimum Python version of 3.9 on anyone who's going to edit PEPs; I think that's not unreasonable. Definitely in favour of doing these sorts of checks in a well-laid-out Python script, there are quite a few checks to be done. |
Yep, I used A |
Yep. Systems that don't have Python 3.9 include Debian Old-Old-Stable aka "Buster" and Ubuntu 20.04LTS "Focal", so I think it's perfectly reasonable to require it. There'll certainly be some servers out there that are on older Pythons, but editing PEPs is an interactive thing and I don't see a problem here. |
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 this! I'd been thinking the same thing :)
We can make this a pre-commit hook too: https://pre-commit.com/#new-hooks (can be a follow-up).
It'd be really good to have some unit tests, so we can easily test what's valid and invalid. (Some type hints would be nice but not essential.)
Not tested yet, here's a few suggestions.
pep-lintrepresents all of the custom PEP lints in.pre-commit-config.yaml, converted into a single Python file. This is for (hopefully) easier maintenance, as I find it quite hard to decipher the regular expressions in.pre-commit-config.yaml, especially as they work on negative matching.I haven't changed
.pre-commit-config.yamlfor now, but when we are confident inpep-lint, I would suggest removing the custom PEP rules such that there is a single-source of truth.A