Skip to content

Commit dccbc03

Browse files
committed
[airbyte-ci] Format using a poe task
This commit moves the choice of formatting implementation into the pyproject.toml file. The benefit of this is that there's a guarantee that you can run `poetry run poe format` and `airbyte-ci format fix python` and they will do the same thing*. Except they will not.
1 parent 5f85707 commit dccbc03

File tree

3 files changed

+40
-18
lines changed

3 files changed

+40
-18
lines changed

airbyte-ci/connectors/pipelines/pipelines/airbyte_ci/format/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ class FormatConfiguration:
5151
Formatter.PYTHON,
5252
["**/*.py"],
5353
format_python_container,
54-
["poetry run isort --settings-file pyproject.toml .", "poetry run black --config pyproject.toml ."],
54+
["poetry run poe format"],
5555
),
5656
]

poetry.lock

Lines changed: 30 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ python = "~3.10"
1111
isort = "5.6.4"
1212
black = "~22.3.0"
1313
ruff = "^0.4"
14+
poethepoet = "^0.26.1"
15+
16+
[tool.poe.tasks]
17+
isort = { cmd = "poetry run isort --settings-file pyproject.toml ." }
18+
black = { cmd = "poetry run black --config pyproject.toml ." }
19+
format = { sequence = [
20+
"isort",
21+
"black",
22+
], help = "Format Python code in the repository. This command is invoked in airbyte-ci format." }
1423

1524
[tool.black]
1625
line-length = 140
@@ -30,22 +39,6 @@ omit = [
3039
"**/generated/*",
3140
]
3241

33-
[tool.flake8]
34-
extend-exclude = [
35-
"*/lib/*/site-packages",
36-
".venv",
37-
"build",
38-
"models",
39-
".eggs",
40-
"airbyte-cdk/python/airbyte_cdk/models/__init__.py",
41-
"airbyte-cdk/python/airbyte_cdk/sources/declarative/models/__init__.py",
42-
".tox",
43-
"airbyte_api_client",
44-
"**/generated/*",
45-
]
46-
max-complexity = 20
47-
max-line-length = 140
48-
4942
extend-ignore = [
5043
"E203", # whitespace before ':' (conflicts with Black)
5144
"E231", # Bad trailing comma (conflicts with Black)

0 commit comments

Comments
 (0)