maxtext icon indicating copy to clipboard operation
maxtext copied to clipboard

Use `ruff` over `pyink`

Open SamuelMarks opened this issue 2 months ago • 0 comments

Description

pyink had 130k downloads last month whereas ruff had 89M. ruff is faster—being written in Rust—and has more configuration options. All the Python communities are switching to this. In the future; and this PR sets the groundwork; would like to switch to ruff over pylint for lint checking also. After that either Rust-written ty (same folks as ruff) or Pyrefly from Meta for type checking; as the pytype we've been using is deprecated (see google/pytype/issues/1838).

Related: #2210

As you can see the code has changed a little, because it takes indentation seriously. You want two-spaces? - Then that will be enforced throughout. Personally I prefer 4 spaces, but it seems that Google takes 2 spaces religiously so that's what this enforces.

PS: Rather than updating in this PR, can we just remove code_style.sh now that we have proper pre commit hooks?

Tests

N/A

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • [x] I have performed a self-review of my code. For an optional AI review, add the gemini-review label.
  • [x] I have necessary comments in my code, particularly in hard-to-understand areas.
  • [x] I have run end-to-end tests tests and provided workload links above if applicable.
  • [x] I have made or will make corresponding changes to the doc if needed.

SamuelMarks avatar Oct 07 '25 21:10 SamuelMarks