diff --git a/.github/workflows/bindings_python.yml b/.github/workflows/bindings_python.yml index 12c38b3c15d..6621950bf89 100644 --- a/.github/workflows/bindings_python.yml +++ b/.github/workflows/bindings_python.yml @@ -40,6 +40,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Ruff Check + working-directory: "bindings/python" + run: | + pip install ruff + ruff check . - uses: PyO3/maturin-action@v1 with: working-directory: "bindings/python" diff --git a/bindings/python/benchmark/async_origin_s3_benchmark_with_gevent.py b/bindings/python/benchmark/async_origin_s3_benchmark_with_gevent.py index a2513c98685..c5c9eb489c3 100644 --- a/bindings/python/benchmark/async_origin_s3_benchmark_with_gevent.py +++ b/bindings/python/benchmark/async_origin_s3_benchmark_with_gevent.py @@ -17,19 +17,17 @@ import greenify -greenify.greenify() - from gevent import monkey -monkey.patch_all() - import timeit - import gevent from boto3 import client as boto3_client from mypy_boto3_s3 import S3Client from pydantic import BaseSettings +greenify.greenify() + +monkey.patch_all() class Config(BaseSettings): aws_region: str diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index 332669184eb..39a326c0817 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -42,6 +42,7 @@ benchmark = [ ] docs = ["pdoc"] test = ["pytest", "python-dotenv", "pytest-asyncio"] +lint = ["ruff"] [project.urls] Documentation = "https://opendal.apache.org/docs/python/opendal.html" @@ -52,3 +53,6 @@ Repository = "https://github.com/apache/opendal" features = ["pyo3/extension-module"] module-name = "opendal._opendal" python-source = "python" + +[tool.ruff.lint] +ignore = ["F403", "F405"]