-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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/black #3840
Merged
Merged
Dev/black #3840
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8b4af69
Black config, pre-commit and GHA
lillekemiker fc9dacd
Black/flake8 line length 100->120
lillekemiker 2183dba
Remove whitespace and commented out pre-commit hooks
lillekemiker 218b6d0
Apply black
lillekemiker 16d0443
(meta) hide the 'black' formatting commit from git blame
ebr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
b3dccfaeb636599c02effc377cdd8a87d658256c | ||
218b6d0546b990fc449c876fb99f44b50c4daa35 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Black # TODO: add isort and flake8 later | ||
|
||
on: | ||
pull_request: {} | ||
push: | ||
branches: master | ||
tags: "*" | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies with pip | ||
run: | | ||
pip install --upgrade pip wheel | ||
pip install .[test] | ||
|
||
# - run: isort --check-only . | ||
- run: black --check . | ||
# - run: flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,6 @@ develop-eggs/ | |
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# See https://pre-commit.com/ for usage and config | ||
repos: | ||
- repo: local | ||
hooks: | ||
- id: black | ||
name: black | ||
stages: [commit] | ||
language: system | ||
entry: black | ||
types: [python] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ | |
type=Path, | ||
default=None, | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
inst = Installer() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Since you're using pre-commit, may I recommend the following action instead:
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.
This is pretty cool. I did not know this existed. Personally I'm a little torn on using it because there's not much gained by using it and it leaves us dependent on an externally managed action. There's also a slight difference in what is being run in the precommit hooks right now. For the sake of speed, they only run black on what is being committed, while the current GHA is running black on everything.
If others prefer using this action, though, I don't feel super strongly about it.
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'm not a dev here, so please remember that I cannot speak for the project at all :-). I understand what you're saying about external actions, although it is pretty official. Perhaps at least run
pre-commit run -a
instead of black directly? It reduces the chance that at some point someone might want to change a parameter or something and will need to remember to sync in both places.IIRC, I think the action it can also be configured to add comments with places that were missed if you pass a token (but possibly not on a PR from a fork). It also includes a
git diff
after it runs, so instead of just a binary "failed", you can see what it fixed, which can be helpful for new contributors who aren't aware of the coding conventions.