-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
(π) Adopt Black and isort as code formatters #12424
Conversation
f33312c
to
41f687d
Compare
This comment has been minimized.
This comment has been minimized.
4 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Can you split the actual formatting to its own commit for review purposes? |
@jhance Done! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2967b20
to
2b1997a
Compare
This comment has been minimized.
This comment has been minimized.
c358440
to
1ad461a
Compare
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
One tip, .git-blame-ignore-revs is useful when doing a large reformatting commit like this. It allows git blame to skip certain commits as otherwise git history becomes more annoying to use. Github is about to support it, https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view (currently in beta) and git cli has supported it for a while. It effectively skips ignored commits when doing git blame. |
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. π€π |
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.
I have just one comment. Please fix it and also rebase the PR (it has conflicts), and then I will merge it. It is waiting for too long.
(This PR always has merge conflicts, which makes it annoying to merge. If you remove the reformatting commit, I'd be happy to merge past CI and reformat with whatever is on master at the time) |
@hauntsaninja the reformat requires manual fixup regarding type comments, I'm happy to rebase and reformat to get these changes done. |
90b36ea
to
17b1c3c
Compare
@ilevkivskyi @hauntsaninja LET'S GOOO!!! |
According to mypy_primer, this change has no effect on the checked open source code. π€π |
1 similar comment
According to mypy_primer, this change has no effect on the checked open source code. π€π |
|
@ilevkivskyi Can you add the pre-commit.ci app to the project configuration now? |
I think I can't, at least I can't figure out how do this (it only allows me to install it to my personal repos). I guess only an org admin can add apps. |
cc @JelleZijlstra who did this for python/typeshed |
Perhaps only owners can add apps? @JukkaL |
Thanks for persisting with this @KotlinIsland, great to see this happen! Very minor, but the "code style with black" README badge doesn't look quite right: |
Thanks! Oops, I'll fix that next chance I get, if someone else doesn't fix it first π |
Description
β When merging this don't squash the commits, we need the config and the formatting kept separate.
Changes:
pyproject.toml
runtests.py
.git-blame-ignore-revs
Anything else?, Oh yeah:
TODO after this is merged
.git-blame-ignore-revs
file ((π) Add black/isort git blame ignore revΒ #13244)If your PR has conflicts follow these steps
git checkout --theirs .; black .; isort .; git add -A; git rebase --continue
Alternative suggestion by @jhance
1. Rebase onto the black configuration commit. 2. Run black and commit on the top of your PR. 3. Re-parent your diff on top of the black commit (NOT a rebase). Checkout the black commit and then `git checkout .` 4. Re-create the original commits 5. Rebase onto master