This is an automated email from the ASF dual-hosted git repository.

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new cabab15b99 feat(bindings/python): add ruff as linter (#4135)
cabab15b99 is described below

commit cabab15b99e21897aa370ede1e2c04d522b328f5
Author: Asuka Minato <[email protected]>
AuthorDate: Sun Feb 4 03:18:33 2024 +0900

    feat(bindings/python): add ruff as linter (#4135)
---
 .github/workflows/bindings_python.yml                             | 5 +++++
 .../python/benchmark/async_origin_s3_benchmark_with_gevent.py     | 8 +++-----
 bindings/python/pyproject.toml                                    | 4 ++++
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/bindings_python.yml 
b/.github/workflows/bindings_python.yml
index 12c38b3c15..6621950bf8 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 a2513c9868..c5c9eb489c 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 332669184e..39a326c081 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"]

Reply via email to