From c2a1791e91a3f33ad817d764a352cf3b4096efc8 Mon Sep 17 00:00:00 2001 From: Wout Bittremieux Date: Sun, 21 Apr 2024 15:35:59 +0200 Subject: [PATCH] Replace black by Ruff --- .pre-commit-config.yaml | 16 +++++++++++----- pyproject.toml | 24 +++--------------------- setup.cfg | 2 +- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dd35db3..19cf96d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,12 @@ repos: - - repo: https://github.com/psf/black - rev: 22.8.0 # Replace by any tag/version: https://github.com/psf/black/tags - hooks: - - id: black - language_version: python3 # Should be a command that runs python3.6+ +- repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.4.1 + hooks: + # Run the linter. + - id: ruff + types_or: [ python, pyi, jupyter ] + args: [ --fix ] + # Run the formatter. + - id: ruff-format + types_or: [ python, pyi, jupyter ] diff --git a/pyproject.toml b/pyproject.toml index 8c70c5b..90b265e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,25 +4,7 @@ build-backend = 'setuptools.build_meta' [tool.setuptools_scm] -[tool.black] +[tool.ruff] line-length = 79 -target-version = ['py312'] -include = '\.pyi?$' -exclude = ''' -( - /( - \.eggs # exclude a few common directories in the - | \.git # root of the project - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - )/ - | foo.py # also separately exclude a file named foo.py in - # the root of the project -) -''' +target-version = "py310" +include = ["*.py"] diff --git a/setup.cfg b/setup.cfg index 6186d4a..50e43f7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -34,9 +34,9 @@ install_requires = [options.extras_require] dev = - black pytest pytest-cov + ruff docs = myst-parser numpydoc>=1.1.0