From 62181ec907a6406505ee9c6c310592947f8c476c Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 6 Nov 2024 14:24:54 -0500 Subject: [PATCH] replace isort with Ruff (#325) --- .github/workflows/test.yml | 4 +- pyproject.toml | 70 ++++++++++++++++++++----------- stubs/vispy/color/color_array.pyi | 10 ++++- 3 files changed, 56 insertions(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f499938..e3e470b2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -42,8 +42,8 @@ jobs: - name: Check out code uses: actions/checkout@v2 - - name: Run isort - uses: isort/isort-action@v1 + - name: Run Ruff + uses: astral-sh/ruff-action@v1 - name: Run Black uses: psf/black@stable diff --git a/pyproject.toml b/pyproject.toml index f0d28c2e..cacfb284 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,41 +2,63 @@ line_length = 130 target_version = ["py37"] -[tool.isort] -profile = "black" -combine_as_imports = true -line_length = 130 -extra_standard_library = [ +[tool.ruff] +line-length = 130 + +[tool.ruff.lint] +select = [ + "I", # isort +] + +[tool.ruff.lint.isort] +combine-as-imports = true +extra-standard-library = [ "typing_extensions", "_typeshed", - # Extra modules not recognized by isort + # Extra modules not recognized by Ruff/isort + "_ast", + "_bisect", + "_bootlocale", + "_codecs", + "_collections_abc", + "_compat_pickle", "_compression", "_csv", + "_ctypes", "_curses", + "_decimal", + "_dummy_thread", + "_dummy_threading", + "_heapq", + "_imp", + "_json", + "_locale", + "_lsprof", "_markupbase", + "_msi", + "_operator", + "_osx_support", + "_posixsubprocess", + "_py_abc", + "_pydecimal", "_random", + "_sitebuiltins", + "_socket", + "_sqlite3", + "_ssl", + "_stat", + "_thread", + "_threading_local", + "_tkinter", + "_tracemalloc", + "_warnings", + "_weakref", "_weakrefset", + "_winapi", "genericpath", "opcode", "pyexpat", - # Python 2 modules - "__builtin__", - "cookielib", - "cStringIO", - "httplib", - "mimetools", - "rfc822", - "thread", - "urllib2", - "urlparse", - "BaseHTTPServer", - "Queue", - "SimpleHTTPServer", - "SocketServer", - "StringIO", - "UserDict", - "UserList", - "UserString", + "zoneinfo", ] [tool.mypy] diff --git a/stubs/vispy/color/color_array.pyi b/stubs/vispy/color/color_array.pyi index d8af5fd9..9afcb49a 100644 --- a/stubs/vispy/color/color_array.pyi +++ b/stubs/vispy/color/color_array.pyi @@ -5,8 +5,14 @@ import numpy as np from ..util import logger from ._color_dict import _color_dict -from .color_space import _rgb_to_hsv # noqa -from .color_space import _hex_to_rgba, _hsv_to_rgb, _lab_to_rgb, _rgb_to_hex, _rgb_to_lab # noqa +from .color_space import ( # noqa + _hex_to_rgba, + _hsv_to_rgb, + _lab_to_rgb, + _rgb_to_hex, + _rgb_to_hsv, # noqa + _rgb_to_lab, +) # -*- coding: utf-8 -*- # Copyright (c) Vispy Development Team. All Rights Reserved.