-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[airbyte-ci] Format using a poe task #38043
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
Changes from all commits
dccbc03
d59ddc4
ff7f3bd
3a644fa
d1da15b
bd4fe76
ab66286
2a5d54c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,24 +11,30 @@ python = "~3.10" | |
isort = "5.6.4" | ||
black = "~22.3.0" | ||
ruff = "^0.4" | ||
poethepoet = "^0.26.1" | ||
|
||
[tool.poe.tasks] | ||
isort = { cmd = "poetry run isort --settings-file pyproject.toml ." } | ||
black = { cmd = "poetry run black --config pyproject.toml ." } | ||
format = { sequence = [ | ||
"isort", | ||
"black", | ||
], help = "Format Python code in the repository. This command is invoked in airbyte-ci format." } | ||
|
||
[tool.black] | ||
line-length = 140 | ||
target-version = ["py310"] | ||
extend-exclude = "(build|integration_tests|unit_tests|generated)" | ||
|
||
[tool.coverage.report] | ||
fail_under = 0 | ||
skip_empty = true | ||
sort = "-cover" | ||
omit = [ | ||
".venv/*", | ||
"main.py", | ||
"setup.py", | ||
"unit_tests/*", | ||
"integration_tests/*", | ||
"**/generated/*", | ||
] | ||
extend-exclude = """ | ||
/( | ||
build | ||
| integration_tests | ||
| unit_tests | ||
| generated | ||
| airbyte-cdk/python/airbyte_cdk/sources/declarative/models | ||
| invalid | ||
| non_formatted_code | ||
)/ | ||
""" | ||
|
||
[tool.flake8] | ||
extend-exclude = [ | ||
|
@@ -37,15 +43,12 @@ extend-exclude = [ | |
"build", | ||
"models", | ||
".eggs", | ||
"airbyte-cdk/python/airbyte_cdk/models/__init__.py", | ||
"airbyte-cdk/python/airbyte_cdk/sources/declarative/models/__init__.py", | ||
".tox", | ||
"airbyte_api_client", | ||
"**/__init__.py", | ||
"**/generated/*", | ||
"**/declarative/models/*", | ||
] | ||
max-complexity = 20 | ||
max-line-length = 140 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Specifically removing this line results in a BARRAGE of problems in python CDK because it tries to do flake check. There are two paths forward — either remove the flake check before this PR, or remove it from this PR and do after. |
||
|
||
extend-ignore = [ | ||
"E203", # whitespace before ':' (conflicts with Black) | ||
"E231", # Bad trailing comma (conflicts with Black) | ||
|
@@ -54,6 +57,19 @@ extend-ignore = [ | |
"F811", # TODO: ella fix after pflake8 version update | ||
] | ||
|
||
[tool.coverage.report] | ||
fail_under = 0 | ||
skip_empty = true | ||
sort = "-cover" | ||
omit = [ | ||
".venv/*", | ||
"main.py", | ||
"setup.py", | ||
"unit_tests/*", | ||
"integration_tests/*", | ||
"**/generated/*", | ||
] | ||
|
||
# TODO: This will be removed in favor of the section below. | ||
[tool.isort] | ||
profile = "black" | ||
|
@@ -65,6 +81,9 @@ include_trailing_comma = true | |
force_grid_wrap = 0 | ||
use_parentheses = true | ||
skip_glob = [ | ||
"airbyte-cdk/python/airbyte_cdk/sources/declarative/models/**", | ||
"**/invalid/**", | ||
"**/non_formatted_code/**", | ||
"**/connector_builder/generated/**", | ||
# TODO: Remove this after we move to Ruff. Ruff is mono-repo-aware and | ||
# correctly handles first-party imports in subdirectories. | ||
|
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.
Meh, let's nuke this in favor of Ruff (soon). Happy to extract into a separate one, but thought I'd remove it while I was there.
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.
Honestly putting this back solves the formatting mismatch in CDK, so perhaps I should scope this PR only on formatting, and not linting, and that might be easier.