-
Notifications
You must be signed in to change notification settings - Fork 134
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
Dev code formatter #534
Dev code formatter #534
Conversation
I think autoformatting is a great thing to have when working on an open source project. I'd like to prompt feedback from some of the other contributors to this project... @bemcdonnell. If we do want to go with blackening the code, I'd also advocate for adding a pre-commit.yaml file with the black hook in there. |
I can add pre-commit, and update/refactor requirements.txt. So, the intended workflow would be like this? (fork)
git clone
git checkout
python -m venv
./activate # or equivalent
pip install -r requirements-dev.txt && pre-commit install
(do things)
git commit .. push .. PR Happy to update the wiki after this. |
@karosc many years ago we used autopep8. I didn’t mind it much and appreciated the always formatted code. I’m in favor of doing this again but I would like to run it locally with a standard tool instead of have a commit hook. The action should check if the formatter wasn’t run .. but I just want to be careful not to over complicate the contribution process. |
@bemcdonnell, I wouldn't want the pre-commit github action running necessarily, just a convenient Pre-commit is a great tool to make sure your code is formatted and linted prior to creating any commit, but I don't think we need to force anyone to use it....the config would just be there for anyone who wants to install it. With ruff and black being so fast, running them on git commits it a very seamless experience and prevents linting workflows from failing in the cloud.
This looks like the right workflow, although I'd opt to put pre-commit in requirements-dev.txt |
@karosc what are the next steps to wrap this PR up? I think the momentum was pretty nice to see :) |
@bemcdonnell, next steps IMO would be to:
thoughts @timothy-holmes? |
@karosc which one of us gets to take that massive commit?!? Do we arm wrestle for it? 😂😂 |
@karosc, @bemcdonnell: I did the blackening and subsquent Have a browse and see if there's anything you don't like. Eg. tests were included, double-quotes replaced single-quotes in many instances. Otherwise, it's pretty much there. |
Nm, I'll do it now |
7c4d9bc
to
b3c37a7
Compare
7c4d9bc
to
031aefa
Compare
I had a crack at adding black the way @karosc suggested. Reverted changes to avoid conflicts with other PR.
Shell history (missing lines are git status or similar):
I also added a GH Actions workflow to enforce formatting.