From caf5c5d93d5ffdf94674852bd439e98bea936c5c Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Sun, 15 Dec 2024 23:59:03 +0800 Subject: [PATCH] deps(isort): replace `isort` with `ruff check --select=I` --- .pre-commit-config.yaml | 6 +----- nvitop-exporter/pyproject.toml | 10 ---------- nvitop/api/device.py | 7 ++++--- nvitop/gui/library/device.py | 3 +-- nvitop/gui/library/process.py | 12 ++++++++++-- pyproject.toml | 18 ++++++++---------- setup.py | 1 - 7 files changed, 24 insertions(+), 33 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5d0fdc3..075ba8b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,14 +25,10 @@ repos: - id: debug-statements - id: double-quote-string-fixer - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.0 + rev: v0.8.3 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - - repo: https://github.com/PyCQA/isort - rev: 5.13.2 - hooks: - - id: isort - repo: https://github.com/psf/black rev: 24.10.0 hooks: diff --git a/nvitop-exporter/pyproject.toml b/nvitop-exporter/pyproject.toml index eaea50f..a64f32c 100644 --- a/nvitop-exporter/pyproject.toml +++ b/nvitop-exporter/pyproject.toml @@ -70,15 +70,5 @@ line-length = 100 skip-string-normalization = true target-version = ["py37"] -[tool.isort] -atomic = true -profile = "black" -src_paths = ["nvitop_exporter"] -known_first_party = ["nvitop", "nvitop_exporter"] -indent = 4 -line_length = 100 -lines_after_imports = 2 -multi_line_output = 3 - [tool.ruff] extend = "../pyproject.toml" diff --git a/nvitop/api/device.py b/nvitop/api/device.py index e8f2930..ef66e7f 100644 --- a/nvitop/api/device.py +++ b/nvitop/api/device.py @@ -132,9 +132,10 @@ from nvitop.api.utils import ( if TYPE_CHECKING: from collections.abc import Hashable - - from typing_extensions import Literal # Python 3.8+ - from typing_extensions import Self # Python 3.11+ + from typing_extensions import ( + Literal, # Python 3.8+ + Self, # Python 3.11+ + ) __all__ = [ diff --git a/nvitop/gui/library/device.py b/nvitop/gui/library/device.py index 30717a8..d29cfc8 100644 --- a/nvitop/gui/library/device.py +++ b/nvitop/gui/library/device.py @@ -5,10 +5,9 @@ from cachetools.func import ttl_cache -from nvitop.api import NA +from nvitop.api import NA, libnvml, utilization2string from nvitop.api import MigDevice as MigDeviceBase from nvitop.api import PhysicalDevice as DeviceBase -from nvitop.api import libnvml, utilization2string from nvitop.gui.library.process import GpuProcess diff --git a/nvitop/gui/library/process.py b/nvitop/gui/library/process.py index 441e131..05d6a94 100644 --- a/nvitop/gui/library/process.py +++ b/nvitop/gui/library/process.py @@ -4,9 +4,17 @@ # pylint: disable=missing-module-docstring,missing-class-docstring,missing-function-docstring -from nvitop.api import NA, GiB +from nvitop.api import ( + NA, + GiB, + HostProcess, + Snapshot, + bytes2human, + host, + timedelta2human, + utilization2string, +) from nvitop.api import GpuProcess as GpuProcessBase -from nvitop.api import HostProcess, Snapshot, bytes2human, host, timedelta2human, utilization2string __all__ = [ diff --git a/pyproject.toml b/pyproject.toml index c6e25aa..c39ff01 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,22 +73,13 @@ line-length = 100 skip-string-normalization = true target-version = ["py37"] -[tool.isort] -atomic = true -profile = "black" -src_paths = ["nvitop", "nvitop-exporter/nvitop_exporter"] -known_first_party = ["nvitop", "nvitop_exporter"] -indent = 4 -line_length = 100 -lines_after_imports = 2 -multi_line_output = 3 - [tool.mypy] # Sync with requires-python python_version = "3.8" # appease mypy for syntax errors in numpy stubs mypy_path = [".", "nvitop-exporter"] exclude = ["nvitop-exporter/setup.py"] pretty = true +show_column_numbers = true show_error_codes = true show_error_context = true show_traceback = true @@ -132,6 +123,7 @@ src = ["nvitop", "nvitop-exporter/nvitop_exporter"] select = [ "E", "W", # pycodestyle "F", # pyflakes + "I", # isort "N", # pep8-naming "UP", # pyupgrade "D", # pydocstyle @@ -206,6 +198,12 @@ ignore = [ "INP001", # flake8-no-pep420 ] +[tool.ruff.lint.isort] +known-first-party = ["nvitop", "nvitop_exporter"] +known-local-folder = ["nvitop", "nvitop-exporter"] +extra-standard-library = ["typing_extensions"] +lines-after-imports = 2 + [tool.ruff.lint.pydocstyle] convention = "google" diff --git a/setup.py b/setup.py index 22d97d7..6cb159a 100755 --- a/setup.py +++ b/setup.py @@ -80,7 +80,6 @@ with vcs_version( extras_require={ 'lint': [ 'black >= 24.0.0, < 25.0.0a0', - 'isort', 'pylint[spelling]', 'mypy', 'typing-extensions',