Skip to content
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

binding/python: Enable ruff for lint and format #3468

Closed
Xuanwo opened this issue Nov 2, 2023 · 9 comments · Fixed by #4135
Closed

binding/python: Enable ruff for lint and format #3468

Xuanwo opened this issue Nov 2, 2023 · 9 comments · Fixed by #4135
Assignees
Labels
bindings/python good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Xuanwo
Copy link
Member

Xuanwo commented Nov 2, 2023

          It's time for us to introduce a python formatter. How about using ruff?

Originally posted by @Xuanwo in #3467 (comment)

@Xuanwo Xuanwo added good first issue Good for newcomers help wanted Extra attention is needed bindings/python labels Nov 2, 2023
@Zheaoli
Copy link
Member

Zheaoli commented Nov 2, 2023

I think black should be better, because it is the most popular code formatter in the Python ecosystem

BTW,we should also import isort as import formatter (lol

@Xuanwo
Copy link
Member Author

Xuanwo commented Nov 2, 2023

I think ruff is the trend. And we love tools written by rust🦀

Ruff can replace black, isort, xxx and it's fast.

@messense
Copy link
Member

messense commented Nov 3, 2023

+1 for ruff, one-stop toolkit (like cargo) provides better developer UX.

@PsiACE
Copy link
Member

PsiACE commented Nov 3, 2023

+1 for ruff

@codeworm96
Copy link

It seems Ruff added the black compatible mode recently. (https://astral.sh/blog/the-ruff-formatter)
And isort is also available. (https://docs.astral.sh/ruff/settings/#isort)

@codeworm96
Copy link

I would like to help investigate adding this infra.

@Zheaoli
Copy link
Member

Zheaoli commented Nov 12, 2023

@codeworm96 Hello, would you mind to share if there is any update for this PR?

@codeworm96
Copy link

codeworm96 commented Nov 15, 2023

Sure. I would like to share my current plan for discussion before submitting the PRs:

  1. we need to add ruff (and ruff confs) to the project: It seems currently dev dependencies as organized as optional-dependencies, like benchmark, docs, tests. I think we can add a new lint category for ruff.
  2. I tested the current code, it did not pass the lint by default. So some code change and/or suppressing some rules are needed.
  3. document lint & format commands
  4. As the final step, I think we should add lint as part of the CI tests once we fix the lint. But I do not have a detailed idea yet.

@Xuanwo
Copy link
Member Author

Xuanwo commented Dec 19, 2023

Hi @codeworm96, are you still on this issue? Can I offer some assistance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bindings/python good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants