From ba34960598e203a5ca2ddb8a235d7d1033949842 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 29 Jan 2024 18:09:53 -0300 Subject: [PATCH] Use ruff in place of black and reorder-python-imports Unfortunately black and reorder-python-imports are no longer compatible between each other: https://github.com/asottile/reorder-python-imports/issues/367 https://github.com/asottile/reorder-python-imports/issues/366 https://github.com/psf/black/issues/4175 Take this opportunity to try out ruff. --- .pre-commit-config.yaml | 14 +++++--------- pyproject.toml | 8 ++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 pyproject.toml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc8f1c7..3b56a69 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,5 @@ exclude: '^($|.*\.bin)' repos: - - repo: https://github.com/psf/black - rev: 23.11.0 - hooks: - - id: black - args: [--safe, --quiet] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: @@ -18,11 +13,12 @@ repos: files: ^(CHANGELOG.rst|README.rst|HOWTORELEASE.rst|changelog/.*)$ language: python additional_dependencies: [pygments, restructuredtext_lint] - - repo: https://github.com/asottile/reorder-python-imports - rev: v3.12.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.14 hooks: - - id: reorder-python-imports - args: ['--application-directories=.:src'] + - id: ruff + args: [ --fix ] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.7.1 hooks: diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f9ef96d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,8 @@ +[build-system] +requires = [ + "setuptools", + "setuptools-scm[toml]", +] +build-backend = "setuptools.build_meta" + +[tool.ruff]