deps(isort): replace isort with ruff check --select=I

This commit is contained in:
Xuehai Pan 2024-12-15 23:59:03 +08:00
parent cb1669e747
commit caf5c5d93d
7 changed files with 24 additions and 33 deletions

View file

@ -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:

View file

@ -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"

View file

@ -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__ = [

View file

@ -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

View file

@ -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__ = [

View file

@ -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"

View file

@ -80,7 +80,6 @@ with vcs_version(
extras_require={
'lint': [
'black >= 24.0.0, < 25.0.0a0',
'isort',
'pylint[spelling]',
'mypy',
'typing-extensions',