From 159eb2d0ffb85b86e00ec1f983d72e72009ec387 Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Fri, 10 Nov 2023 11:40:31 +0100 Subject: [PATCH] Switch out black for ruff format (#1698) Saves one pre-commit hook, some pyproject.toml configuration, and provides much better performance with almost identical behavior. Co-authored-by: dominic <510002+dmah42@users.noreply.github.com> --- .pre-commit-config.yaml | 9 +++------ pyproject.toml | 7 +------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5c4a3df8..a1f08341 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,12 +10,9 @@ repos: - id: mypy types_or: [ python, pyi ] args: [ "--ignore-missing-imports", "--scripts-are-modules" ] - - repo: https://github.com/psf/black - rev: 23.10.1 - hooks: - - id: black - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.1.5 hooks: - id: ruff - args: [ --fix, --exit-non-zero-on-fix ] \ No newline at end of file + args: [ --fix, --exit-non-zero-on-fix ] + - id: ruff-format \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 442cef36..5e70b313 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,12 +56,6 @@ readme = { file = "README.md", content-type = "text/markdown" } [tool.setuptools_scm] -[tool.black] -# Source https://github.com/psf/black#configuration-format -include = "\\.pyi?$" -line-length = 80 -target-version = ["py311"] - [tool.mypy] check_untyped_defs = true disallow_incomplete_defs = true @@ -78,6 +72,7 @@ ignore_missing_imports = true # explicitly tell ruff the source directory to correctly identify first-party package. src = ["bindings/python"] line-length = 80 +target-version = "py311" # Enable pycodestyle (`E`, `W`), Pyflakes (`F`), and isort (`I`) codes by default. select = ["E", "F", "I", "W"] ignore = [