-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Enable Black - Python Auto Formmatter #9550
Conversation
Do you guys have any opinion if we should delay "Black" or do it now? We can also enable this on |
Have you considered enabling the "--skip-string-normalization" option? This should reduce the number of changes without compromising the readability of the code.
Thanks to this, we will only have whitespace changes. |
Applied |
The Build Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks$,^Build docs$,^Spell check docs$,^Backport packages$,^Checks: Helm tests$,^Test OpenAPI*. |
The Workflow run is cancelling this PR. It has some failed jobs matching ^Pylint$,^Static checks,^Build docs$,^Spell check docs$,^Backport packages$,^Provider packages,^Checks: Helm tests$,^Test OpenAPI*. |
b7ceb32
to
8c5e313
Compare
@@ -159,8 +159,7 @@ repos: | |||
rev: 20.8b1 | |||
hooks: | |||
- id: black | |||
files: api_connexion/.*\.py|.*providers.*\.py|^chart/tests/.*\.py | |||
exclude: .*kubernetes_pod\.py|.*google/common/hooks/base_google\.py$ | |||
exclude: .*kubernetes_pod\.py|.*google/common/hooks/base_google\.py$|^airflow/configuration.py$ |
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.
Any reason for this exclude?
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.
Yes, black had issues with it i.e. it couldn't reproduce the same file pre and post black so it would be good to ignore them for now
❯ pre-commit run black -a
black....................................................................Failed
- hook id: black
- exit code: 123
error: cannot format /Users/kaxilnaik/Documents/Github/astronomer/airflow/airflow/configuration.py: INTERNAL ERROR: Black produced different code on the second pass of the formatter. Please report a bug on https://github.com/psf/black/issues. This diff might be helpful: /var/folders/jk/z68c_8nd1w5ggdc51r5zhnxm0000gn/T/blk_madaodvm.log
Oh no! 💥 💔 💥
2548 files left unchanged, 1 file failed to reformat.
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.
Interesting 👀
The PR needs to run all tests because it modifies core of Airflow! Please rebase it to latest master or ask committer to re-run it! |
(cherry-picked from commit 4e8f9cc)
(cherry-picked from commit 4e8f9cc)
(cherry-picked from commit 4e8f9cc)
Enable Black (https://github.com/psf/black) using pre-commit
Make sure to mark the boxes below before creating PR: [x]
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.