Skip to content

[Internal] Switch code formatter to Black #900

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 3 commits into from
Feb 27, 2025

Conversation

renaudhartert-db
Copy link
Contributor

@renaudhartert-db renaudhartert-db commented Feb 26, 2025

What changes are proposed in this pull request?

This PR switches the code formatter from yapf to black.

The rationale is that we want a code formatter that (i) leaves as little space as possible for discussions around formatting personal preferences, and (ii) increases the likelihood of producing code that is consistently formatted across the python open-source ecosystem.

At this point in time, we believe that black does a better job than yapf and other alternatives to address these two problems.

How is this tested?

No additional tests.

NO_CHANGELOG=true

Copy link

If integration tests don't run automatically, an authorized user can run them manually by following the instructions below:

Trigger:
go/deco-tests-run/sdk-py

Inputs:

  • PR number: 900
  • Commit SHA: 0aab32ea73d42590ff8438a294d600275e2a6cba

Checks will be approved automatically on success.

@denik
Copy link

denik commented Feb 26, 2025

Why not ruff? It is compatible with black and comes with a lot of lint rules. Much faster as well.

@renaudhartert-db
Copy link
Contributor Author

renaudhartert-db commented Feb 26, 2025

Why not ruff? It is compatible with black and comes with a lot of lint rules. Much faster as well.

Formatting speed and linting are not problems we're trying to address at this point in time. It is possible that we will converge toward Ruff once we're done experimenting and have identified the tools we want to rely on. For now, we believe that moving to Black is a strict improvement of the status quo, which is easy to undo if we have to.

@renaudhartert-db renaudhartert-db added this pull request to the merge queue Feb 27, 2025
Merged via the queue into main with commit 220eaad Feb 27, 2025
23 of 24 checks passed
@renaudhartert-db renaudhartert-db deleted the renaud.hartert/black-fmt branch February 27, 2025 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants