From 13cfb8616c50d8ac1fa47a6c640cadac306da9f6 Mon Sep 17 00:00:00 2001 From: Ethan Paul <24588726+enpaul@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:26:51 -0400 Subject: [PATCH] Replace reorder-python-imports with isort See here for indept explanation: https://github.com/psf/black/issues/4175 See here (and related) for the attitude: https://github.com/asottile/reorder-python-imports/issues/366 --- .pre-commit-config.yaml | 7 ++++--- poetry.lock | 41 +---------------------------------------- pyproject.toml | 7 ++++++- 3 files changed, 11 insertions(+), 44 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cac7c75..b8c3d7a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,12 +47,13 @@ repos: - id: reorder-python-imports name: reorder-python-imports - entry: reorder-python-imports + entry: isort language: system - args: - - "--unclassifiable-application-module=tox_poetry_installer" + require_serial: true types: - python + args: + - "--filter-files" - id: black name: black diff --git a/poetry.lock b/poetry.lock index 8b92059..0a383d8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,19 +1,5 @@ # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. -[[package]] -name = "aspy-refactor-imports" -version = "2.3.0" -description = "Utilities for refactoring imports in python-like syntax." -optional = false -python-versions = ">=3.7" -files = [ - {file = "aspy.refactor_imports-2.3.0-py2.py3-none-any.whl", hash = "sha256:a60432fc0c0b948aa371da520b896ddcbbee71b1820eeda6d2c04f039bac13b9"}, - {file = "aspy.refactor_imports-2.3.0.tar.gz", hash = "sha256:5a7775b31e55a762f807c218a3f9f1a7ff1313d766605a301f2ed937cdfa242a"}, -] - -[package.dependencies] -cached-property = "*" - [[package]] name = "astroid" version = "2.15.8" @@ -222,17 +208,6 @@ requests = "*" filecache = ["lockfile (>=0.9)"] redis = ["redis (>=2.10.5)"] -[[package]] -name = "cached-property" -version = "1.5.2" -description = "A decorator for caching properties in classes." -optional = false -python-versions = "*" -files = [ - {file = "cached-property-1.5.2.tar.gz", hash = "sha256:9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130"}, - {file = "cached_property-1.5.2-py2.py3-none-any.whl", hash = "sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0"}, -] - [[package]] name = "cachetools" version = "5.4.0" @@ -2042,20 +2017,6 @@ files = [ [package.extras] full = ["numpy"] -[[package]] -name = "reorder-python-imports" -version = "2.8.0" -description = "Tool for reordering python imports" -optional = false -python-versions = ">=3.7" -files = [ - {file = "reorder_python_imports-2.8.0-py2.py3-none-any.whl", hash = "sha256:03354608c610a25cba75a352ad86552849dcf3c90849fcb415298efc911a4ecf"}, - {file = "reorder_python_imports-2.8.0.tar.gz", hash = "sha256:435af2a6feb39de3c4b7a415079f85b4b0052d3a7ed9ea7b269b0aff725abdaf"}, -] - -[package.dependencies] -"aspy.refactor-imports" = ">=2.3.0,<3" - [[package]] name = "requests" version = "2.31.0" @@ -2620,4 +2581,4 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "56d0abc08c141d404c8dcc5ecf669b54fb49d85463abf3e74de36604b7a31b21" +content-hash = "1c2c4bc0efd7f65e20cfa78e9418d00921cd4d68edb1233b0796294cc749041d" diff --git a/pyproject.toml b/pyproject.toml index a56f645..c3a1956 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,7 @@ bandit = {version = "^1.7.7", python = "^3.10"} black = {version = "^24.3.0", python = "^3.10"} blacken-docs = {version = "^1.8.0", python = "^3.10"} ipython = {version = "^8.10.1", python = "^3.10"} +isort = {version = "^5.13.2", python = "^3.10"} mdformat = {version = "^0.7", python = "^3.10"} mdformat-gfm = {version = "^0.3", python = "^3.10"} mypy = {version = "^0.930", python = "^3.10"} @@ -54,11 +55,15 @@ pre-commit-hooks = {version = "^3.3.0", python = "^3.10"} pylint = {version = "^2.13.0", python = "^3.10"} pytest = {version = "^6.0.2", python = "^3.10"} pytest-cov = {version = "^2.10.1", python = "^3.10"} -reorder-python-imports = {version = "^2.3.5", python = "^3.10"} toml = {version = "^0.10.1", python = "^3.10"} tox = "^4.1" types-toml = {version = "^0.10.1", python = "^3.10"} +[tool.isort] +profile = "black" +force_single_line = "true" +lines_after_imports = 2 + [build-system] requires = ["poetry-core>=1.1.0"] build-backend = "poetry.core.masonry.api"