Skip to content

[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

Merged
merged 8 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ class FormatConfiguration:
Formatter.PYTHON,
["**/*.py"],
format_python_container,
["poetry run isort --settings-file pyproject.toml .", "poetry run black --config pyproject.toml ."],
["poetry run poe format"],
),
]
31 changes: 30 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 9 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ 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
Expand All @@ -30,22 +39,6 @@ omit = [
"**/generated/*",
]

[tool.flake8]
Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

extend-exclude = [
"*/lib/*/site-packages",
".venv",
"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",
"**/generated/*",
]
max-complexity = 20
max-line-length = 140
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
Expand Down
Loading