From bf64163b64f3363db5740180a1325fdf2877ab6c Mon Sep 17 00:00:00 2001 From: Matt Fisher Date: Tue, 29 Aug 2023 19:36:33 -0600 Subject: [PATCH] Remove flake8 and isort in favor of Ruff In #490, Ruff was added to try it out. Ruff could theoretically replace isort and flake8. This commit removes them and removes compatibility hacks in case we decide we do want to drop isort and flake8. --- .flake8 | 10 ---------- .pre-commit-config.yaml | 12 ------------ conda_lock/lockfile/v2prelim/models.py | 7 +++---- pyproject.toml | 14 -------------- 4 files changed, 3 insertions(+), 40 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 684ff8df..00000000 --- a/.flake8 +++ /dev/null @@ -1,10 +0,0 @@ -[flake8] -# NOTE: Can ruff replace flake8? See `tool.isort`, these two configs should be -# kept in sync until we pick one. -ignore = E203, E266, E501, W503, F403, F401 -per-file-ignores = - conda_lock/src_parser/meta_yaml.py:E122 - -max-line-length = 89 -max-complexity = 19 -select = B,C,E,F,W,T4,B9 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8c45525a..7d51e8eb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,18 +24,6 @@ repos: - id: ruff args: ["--fix"] -# Ruff should catch (and mostly fix) everything that flake8 and isort do; if -# either of these checks fails, can Ruff's config be updated to catch the same? -- repo: https://github.com/pycqa/flake8 - rev: 6.1.0 - hooks: - - id: flake8 -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - args: ["--profile", "black", "--filter-files"] - - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.5.1 hooks: diff --git a/conda_lock/lockfile/v2prelim/models.py b/conda_lock/lockfile/v2prelim/models.py index 71ad4352..2cc35c26 100644 --- a/conda_lock/lockfile/v2prelim/models.py +++ b/conda_lock/lockfile/v2prelim/models.py @@ -1,6 +1,3 @@ -# isort: skip_file -# TODO: Remove the isort skip comment above if/when isort is no longer used. This skip -# exists because isort and ruff disagree about how to sort the imports in this file. from collections import defaultdict from typing import ClassVar, Dict, List, Optional @@ -10,10 +7,12 @@ GitMeta, HashModel, InputMeta, + LockMeta, + MetadataOption, + TimeMeta, ) from conda_lock.lockfile.v1.models import LockedDependency as LockedDependencyV1 from conda_lock.lockfile.v1.models import Lockfile as LockfileV1 -from conda_lock.lockfile.v1.models import LockMeta, MetadataOption, TimeMeta from conda_lock.models import StrictModel diff --git a/pyproject.toml b/pyproject.toml index 9fb2c0b6..b6523232 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,18 +108,6 @@ exclude = [ "tests", ] -[tool.isort] -# NOTE: Can ruff replace isort? See `tool.ruff.isort`, these two configs should -# be kept in sync until we pick one. -atomic = true -force_grid_wrap = 0 -include_trailing_comma = true -lines_after_imports = 2 -lines_between_types = 1 -multi_line_output = 3 -use_parentheses = true -known_first_party = "attr" - [tool.pytest.ini_options] addopts = "-vrsx -n auto" flake8-max-line-length = 105 @@ -199,8 +187,6 @@ select = [ max-complexity = 18 [tool.ruff.isort] -# NOTE: Can ruff replace isort? See `tool.isort`, these two configs should be -# kept in sync until we pick one. lines-after-imports = 2 lines-between-types = 1 known-first-party = ["attr"]