Skip to content

Commit 72bc6e3

Browse files
authored
Remove isort, black and flake8, replace with ruff (#1808)
SUMMARY: Ruff supports import sorting, formatting, and linting. We already use if for formatting (`black` is listed as a dev dependency but isn't used) and linting. In this pr: - 6af05b1 - Cleans up `pyproject.toml`, removing old configs/updating ruff configs to also check import sorting - Updates `Makefile` to just call `ruff` in `make quality` and `make style` - Removes `black`, `flake8`, and `isort` from dev dependencies - Updates dev docs description of `make quality` command - 796a5b8 - Replaces `flake8: noqa` file wide markers with `ruff: noqa` (not strictly necessary since `ruff` will respect the `flake8: noqa` markers but for cleanliness) - Removes unnecessary `isort: skip_file` markers Note: this is builds off changes from #1807 --------- Signed-off-by: Fynn Schmitt-Ulms <[email protected]>
1 parent 90aa7b8 commit 72bc6e3

File tree

51 files changed

+54
-74
lines changed

Some content is hidden

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

51 files changed

+54
-74
lines changed

DEVELOPING.md

Lines changed: 1 addition & 2 deletions

Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,12 @@ quality:
2626
@echo "Running python quality checks";
2727
ruff check $(CHECKDIRS);
2828
ruff format --check $(CHECKDIRS);
29-
isort --check-only $(CHECKDIRS);
30-
flake8 $(CHECKDIRS) --max-line-length 88 --extend-ignore E203,W605;
3129

3230
# style the code according to accepted standards for the repo
3331
style:
3432
@echo "Running python styling";
33+
ruff check --fix $(CHECKDIRS);
3534
ruff format $(CHECKDIRS);
36-
isort $(CHECKDIRS);
37-
flake8 $(CHECKDIRS) --max-line-length 88 --extend-ignore E203,W605;
3835

3936
# run tests for the repo
4037
test:

docs/developer/developing.md

Lines changed: 1 addition & 2 deletions

pyproject.toml

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,17 @@
22
requires = ["setuptools", "wheel", "setuptools_scm==8.2.0"]
33
build-backend = "setuptools.build_meta"
44

5-
[tool.black]
6-
line-length = 88
7-
target-version = ['py38']
8-
9-
[tool.isort]
10-
profile = "black"
11-
skip = ["src/llmcompressor/transformers/tracing/", "src/llmcompressor/version.py"]
12-
135
[tool.mypy]
146
files = "src/guidellm"
157

168
[tool.ruff]
17-
exclude = ["build", "dist", "env", ".venv", "src/llmcompressor/transformers/tracing/", "src/llmcompressor/version.py"]
18-
lint.select = ["E", "F", "W"]
9+
extend-exclude = ["env", "src/llmcompressor/transformers/tracing/", "src/llmcompressor/version.py"]
10+
line-length = 88
11+
lint.select = ["E", "F", "W", "I"]
1912
lint.extend-ignore = ["E203", "W605"]
2013

21-
# flake8 configuration is non-functional, only exists for vscode extensions
22-
# for the true flake8 configuration, see `Makefile`
23-
[tool.flake8]
24-
max-line-length = 88
25-
extend-ignore = ["E203", "W605"]
14+
[tool.ruff.lint.isort]
15+
known-first-party = ["llmcompressor"]
2616

2717
[tool.pytest.ini_options]
2818
markers = [

setup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,8 @@ def localversion_func(version: ScmVersion) -> str:
159159
"soundfile",
160160
"torchcodec",
161161
# linting, formatting, and type checking
162-
"black~=24.4.2",
163-
"isort~=5.13.2",
164162
"mypy~=1.10.0",
165163
"ruff~=0.4.8",
166-
"flake8~=7.0.0",
167164
# pre commit hooks
168165
"pre-commit",
169166
# docs

src/llmcompressor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
PyTorch and HuggingFace Transformers, allowing for quick experimentation.
77
"""
88

9-
# flake8: noqa
9+
# ruff: noqa
1010

1111
from .logger import LoggerConfig, configure_logger, logger
1212
from .version import __version__, version

src/llmcompressor/args/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flake8: noqa
1+
# ruff: noqa
22

33
from .dataset_arguments import DatasetArguments
44
from .model_arguments import ModelArguments

src/llmcompressor/datasets/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flake8: noqa
1+
# ruff: noqa
22

33
from .utils import (
44
format_calibration_data,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flake8: noqa
1+
# ruff: noqa
22
from .oneshot import Oneshot, oneshot
33
from .train import train
44
from .utils import post_process, pre_process
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# flake8: noqa
1+
# ruff: noqa
22

33
from .logger import *

0 commit comments

Comments
 (0)