diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b678e5b9aa..d16759cdc7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,18 +37,6 @@ repos: exclude_types: [json, pofile] exclude: 'changelog/|py.typed|disnake/bin/COPYING|.github/PULL_REQUEST_TEMPLATE.md|.github/CODEOWNERS|LICENSE|MANIFEST.in' - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - args: ["--profile", "black", "--extend-skip", "examples"] - name: "run isort in all files" - exclude: ^examples/ - - id: isort - args: ["--profile", "black", "--thirdparty", "disnake"] - name: "run isort in examples" - files: ^examples/ - - repo: https://github.com/psf/black-pre-commit-mirror rev: 23.9.1 hooks: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e1151d59b3..60c31f2f44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -70,7 +70,7 @@ Once PDM is installed, use the following command to initialize a virtual environ $ pdm run setup_env ``` -Other tools used in this project include [black](https://black.readthedocs.io/en/stable/) + [isort](https://pycqa.github.io/isort/) (formatters), [ruff](https://beta.ruff.rs/docs/) (linter), and [pyright](https://microsoft.github.io/pyright/#/) (type-checker). For the most part, these automatically run on every commit with no additional action required - see below for details. +Other tools used in this project include [black](https://black.readthedocs.io/en/stable/) (formatter), [ruff](https://beta.ruff.rs/docs/) (linter), and [pyright](https://microsoft.github.io/pyright/#/) (type-checker). For the most part, these automatically run on every commit with no additional action required - see below for details. All of the following checks also automatically run for every PR on GitHub, so don't worry if you're not sure whether you missed anything. A PR cannot be merged as long as there are any failing checks. diff --git a/examples/basic_voice.py b/examples/basic_voice.py index 45046c780f..2df07072bd 100644 --- a/examples/basic_voice.py +++ b/examples/basic_voice.py @@ -11,8 +11,9 @@ import os from typing import Any, Dict, Optional -import disnake import youtube_dl # type: ignore + +import disnake from disnake.ext import commands # Suppress noise about console usage from errors diff --git a/examples/interactions/injections.py b/examples/interactions/injections.py index 30c7554dd6..78e587a98d 100644 --- a/examples/interactions/injections.py +++ b/examples/interactions/injections.py @@ -4,10 +4,10 @@ from dataclasses import dataclass from typing import Any, Literal, Optional -import disnake - # this file uses pytz in one of its examples but it is completely optional import pytz + +import disnake from disnake.ext import commands bot = commands.Bot(command_prefix=commands.when_mentioned) diff --git a/pyproject.toml b/pyproject.toml index 171f76a245..3be638228b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,6 @@ build = [ [tool.pdm.scripts] black = { composite = ["lint black"], help = "Run black" } docs = { cmd = "nox -Rs docs --", help = "Build the documentation for development" } -isort = { composite = ["lint isort"], help = "Run isort" } lint = { cmd = "nox -Rs lint --", help = "Check all files for linting errors" } pyright = { cmd = "nox -Rs pyright --", help = "Run pyright" } setup_env = { cmd = "pdm install -d -G speed -G docs -G voice", help = "Set up the local environment and all dependencies" } @@ -117,7 +116,6 @@ test = { cmd = "nox -Rs test --", help = "Run pytest" } [tool.taskipy.tasks] black = { cmd = "black", help = "Run black" } docs = { cmd = "docs", help = "Build the documentation for development" } -isort = { cmd = "isort", help = "Run isort" } lint = { cmd = "lint", help = "Check all files for linting errors" } pyright = { cmd = "pyright", help = "Run pyright" } setup_env = { cmd = "setup_env", help = "Setup the local environment and set up all dependencies" } @@ -130,13 +128,6 @@ runner = "pdm run" line-length = 100 target-version = ["py38", "py39", "py310", "py311", "py312"] -[tool.isort] -profile = "black" -py_version = 38 -line_length = 100 -combine_as_imports = true -filter_files = true - [tool.ruff] line-length = 100 target-version = "py38" @@ -171,6 +162,7 @@ select = [ # "PLR", # pylint refactor "PLW", # pylint warnings "TRY002", "TRY004", "TRY201", # tryceratops + "I", ] ignore = [ # star imports @@ -202,7 +194,7 @@ ignore = [ # typevar names don't match variance (we don't always want this) "PLC0105", - # import aliases are fixed by isort + # import aliases are fixed by ruff "PLC0414", # outer loop variables are overwritten by inner assignment target, these are mostly intentional @@ -253,6 +245,9 @@ ignore = [ "examples/basic_voice.py" = ["S104"] # possible binding to all interfaces "examples/views/tic_tac_toe.py" = ["E741"] # ambigious variable name: `O` +[tool.ruff.lint.isort] +combine-as-imports = true + [tool.ruff.lint.pydocstyle] convention = "numpy"