From 93a4930f0aeaec05a2d68b219eac729eda9f4294 Mon Sep 17 00:00:00 2001 From: PeterDing Date: Sun, 4 Feb 2024 15:01:36 +0800 Subject: [PATCH] Use ruff --- .github/workflows/main.yml | 12 ++++-------- Makefile | 11 +++-------- pyproject.toml | 12 +++++++----- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a2e458..0433760 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,14 +28,10 @@ jobs: poetry run pip3 install setuptools poetry install --no-root if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' - - name: Format check with black - run: poetry run black --check . - - name: Typecheck with mypy at Windows - run: poetry run mypy -p alipcs_py --ignore-missing-imports --warn-unreachable --implicit-optional --allow-redefinition --disable-error-code abstract --disable-error-code attr-defined - if: matrix.os == 'windows-latest' - - name: Typecheck with mypy at Linux - run: poetry run mypy -p alipcs_py --ignore-missing-imports --warn-unreachable --implicit-optional --allow-redefinition --disable-error-code abstract - if: matrix.os == 'ubuntu-latest' + - name: Format check + run: poetry run ruff format --check . + - name: Typecheck + run: poetry run ruff check alipcs_py - name: Test with pytest run: | poetry run python build.py build_ext --inplace diff --git a/Makefile b/Makefile index 899a433..b691fa5 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,12 @@ typecheck: - mypy -p alipcs_py \ - --ignore-missing-imports \ - --warn-unreachable \ - --implicit-optional \ - --allow-redefinition \ - --disable-error-code abstract + ruff check alipcs_py format-check: - black --check . + ruff format --check . format: - black . + ruff format . build-pyx: python build.py build_ext --inplace diff --git a/pyproject.toml b/pyproject.toml index 615f065..cb4f486 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,13 +19,12 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] -build = "build.py" [tool.black] line-length = 119 [tool.ruff] -ignore = ["E501", "F401", "F841"] +ignore = ["E501", "E402", "F401", "F403", "F841"] line-length = 119 [tool.poetry.dependencies] @@ -51,11 +50,14 @@ passlib = ">=1.7" [tool.poetry.group.dev.dependencies] pytest = ">=7.4" -mypy = ">=1.7" -black = ">=23.11" +ruff = ">=0.2" setuptools = ">=69.0" cython = ">=3.0" +[tool.poetry.build] +script = "build.py" +generate-setup-file = true + [tool.poetry.scripts] AliPCS-Py = 'alipcs_py.app:main' @@ -63,4 +65,4 @@ AliPCS-Py = 'alipcs_py.app:main' reportGeneralTypeIssues = true [build-system] -requires = ["cython", "wheel", "setuptools"] +requires = ["poetry-core", "cython", "wheel", "setuptools"]