Skip to content

Prefer ruff formatting#462

Merged
danieldk merged 10 commits into
mainfrom
prefer-ruff-formatting
Apr 17, 2026
Merged

Prefer ruff formatting#462
danieldk merged 10 commits into
mainfrom
prefer-ruff-formatting

Conversation

@drbh

@drbh drbh commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

this pr update the repo to prefer using ruff formatting over black and isort. additionally it adds griffe to add a check for any breaking changes to public functions

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@drbh

drbh commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator Author

I think the failing test is unrelated and introduced in #467?

@drbh drbh mentioned this pull request Apr 16, 2026
2 tasks

@sayakpaul sayakpaul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one major comment.

kernels
with:
src: kernels
version: "0.15.10"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we always want to run with latest ruff?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pinning the ruff version is not a bad idea, since there will be subtle formatting differences between versions and then if CI uses the latest and a local venv or Nix env uses a different version, then there will always be mismatches.

black:
name: Run black check
griffe:
name: Check API compatibility

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ou jazzy. I didn't know this!

Comment thread kernels/pyproject.toml
# "E501" -> line length violation
lint.ignore = ["E501"]
lint.select = ["E", "F", "W"]
lint.select = ["E", "F", "I", "W"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to also instruct ruff to take care of sorting the imports, remove unused imports, etc. if not already done?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like I enables import formatting, resorting, and it is run as part of linting:

astral-sh/ruff#8926 (comment)

Since we are running ruff check --fix, it should be good I think.

@danieldk danieldk merged commit 178616a into main Apr 17, 2026
48 checks passed
@danieldk danieldk deleted the prefer-ruff-formatting branch April 17, 2026 09:10
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.

4 participants