Skip to content

Commit 9980f79

Browse files
committed
Migrate Python linting and formatting to Ruff
1 parent f5e2010 commit 9980f79

78 files changed

Lines changed: 7244 additions & 6885 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ PATH := $(CLANG_TIDY_WRAPPER_DIR):$(HOME)/go/bin:$(PATH)
2525
check_install = python3 -c "import $(1)" || (cd && pip3 install $(1) --upgrade && cd -)
2626
check_install_extra = python3 -c "import $(1)" || (cd && pip3 install $(2) --upgrade && cd -)
2727

28-
flake8-install:
29-
$(call check_install, flake8)
30-
$(call check_install_extra, bugbear, flake8_bugbear)
28+
ruff-install:
29+
$(call check_install, ruff)
3130

3231
py-format-install:
33-
$(call check_install, isort)
34-
$(call check_install, yapf)
32+
$(call check_install, ruff)
3533

3634
mypy-install:
3735
$(call check_install, mypy)
@@ -88,13 +86,15 @@ release-system-install:
8886
(dnf install -y perl-IO-Compress && dnf clean all); \
8987
fi
9088

91-
# python linter
89+
# python style / lint
9290

93-
flake8: flake8-install
94-
flake8 $(PYTHON_FILES) --count --show-source --statistics
91+
ruff: ruff-install
92+
ruff check $(PYTHON_FILES)
93+
94+
flake8: ruff
9595

9696
py-format: py-format-install
97-
isort --check $(PYTHON_FILES) && yapf -r -d $(PYTHON_FILES)
97+
ruff format --check $(PYTHON_FILES)
9898

9999
mypy: mypy-install
100100
mypy $(PROJECT_NAME)
@@ -165,11 +165,11 @@ doc-benchmark:
165165
pandoc benchmark/README.md --from markdown --to rst -s -o docs/content/benchmark.rst --columns 1000
166166
cd benchmark && ./plot.py --suffix png && mv *.png ../docs/_static/images/throughput
167167

168-
lint: buildifier flake8 py-format clang-format cpplint clang-tidy mypy docstyle spelling
168+
lint: buildifier ruff py-format clang-format cpplint clang-tidy mypy docstyle spelling
169169

170170
format: py-format-install clang-format-install buildifier-install addlicense-install
171-
isort $(PYTHON_FILES)
172-
yapf -ir $(PYTHON_FILES)
171+
ruff check --fix $(PYTHON_FILES)
172+
ruff format $(PYTHON_FILES)
173173
clang-format -style=file -i $(CPP_FILES)
174174
buildifier -r -lint=fix $(BAZEL_FILES)
175175
addlicense -c $(COPYRIGHT) -l apache -y 2026 $(PROJECT_FOLDER)

0 commit comments

Comments
 (0)