-
Notifications
You must be signed in to change notification settings - Fork 421
Replace black by Ruff Formatter #127
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
Conversation
|
Looks fine overall, but it seems like too many changes with string normalization. Why force string normalization? That's going to cause a ton of pull requests to fail formatting validation. |
.pre-commit-config.yaml
Outdated
| - id: check-ast | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| # Ruff version (Used for linting) | ||
| rev: v0.0.291 |
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.
Does it come with the new version? I don't see any related config (for example, line length)
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 it was introduced in https://github.com/astral-sh/ruff/releases/tag/v0.0.290, but I used the newer version to get some patches.
It is not supported yet; we can wait for astral-sh/ruff#8822 before merging. |
|
@hussein-awala the PR has been merged :) |
I was waiting for the release, the merged PR was released 3 days ago in v0.1.8 as a preview feature, for that I had to add
@rdblue could you check it now after changing |
Fokko
left a comment
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.
It looks like there are still differences, but I like them since it makes the code a bit more dense, without sacrificing readability.
|
Looks good to me now. Thanks, @hussein-awala! |
|
I just merged main and fixed the conflicts, it should be ready to merge. |
Fokko
left a comment
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.
Thanks again @hussein-awala for the contribution, and @rdblue for the review 🙌
|
We need to merge #253 to fix the failed tests in main. |
* Replace black by Ruff Formatter * update ruff version * fix format * Update ruff format and add preserve as a quote style
# Rationale for this change This PR removes [tool.black] from pyproject.toml. This is an unused config since formatting now lives in [ruff.toml](https://github.com/apache/iceberg-python/blob/main/ruff.toml). Also, updates contributing.md to reference ruff instead of black. This PR removes dead config from pyproject.toml: - [tool.black] - replaced by ruff-format #127 - [tool.pycln] - replaced by ruff #1485 Also updates contributing.md to reference ruff instead of black. ## Are these changes tested? Yes ## Are there any user-facing changes? No
This PR replaces black with Ruff Formatter, which is 30x faster (https://astral.sh/blog/the-ruff-formatter). It also removes the
--skip-string-normalizationconfig to replace single quotes with double quotes.related: apache/iceberg#8294