### What problem does this PR solve? Sometimes after we commit the code and open the PR the CI pipeline fails in Ruff checks. Including a pre-commit we can identify this problem early and avoid time loss. ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [X] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe):tags/v0.19.0
| repos: | |||||
| - repo: https://github.com/pre-commit/pre-commit-hooks | |||||
| rev: v4.6.0 | |||||
| hooks: | |||||
| - id: check-yaml | |||||
| - id: check-json | |||||
| - id: end-of-file-fixer | |||||
| - id: trailing-whitespace | |||||
| - id: check-case-conflict | |||||
| - id: check-merge-conflict | |||||
| - id: mixed-line-ending | |||||
| - id: check-symlinks | |||||
| - repo: https://github.com/astral-sh/ruff-pre-commit | |||||
| rev: v0.11.6 | |||||
| hooks: | |||||
| - id: ruff | |||||
| args: [ --fix ] | |||||
| - id: ruff-format |
| 1. Install uv, or skip this step if it is already installed: | 1. Install uv, or skip this step if it is already installed: | ||||
| ```bash | ```bash | ||||
| pipx install uv | |||||
| pipx install uv pre-commit | |||||
| ``` | ``` | ||||
| 2. Clone the source code and install Python dependencies: | 2. Clone the source code and install Python dependencies: | ||||
| git clone https://github.com/infiniflow/ragflow.git | git clone https://github.com/infiniflow/ragflow.git | ||||
| cd ragflow/ | cd ragflow/ | ||||
| uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | ||||
| pre-commit install | |||||
| ``` | ``` | ||||
| 3. Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose: | 3. Launch the dependent services (MinIO, Elasticsearch, Redis, and MySQL) using Docker Compose: |
| 1. Instal uv, atau lewati langkah ini jika sudah terinstal: | 1. Instal uv, atau lewati langkah ini jika sudah terinstal: | ||||
| ```bash | ```bash | ||||
| pipx install uv | |||||
| pipx install uv pre-commit | |||||
| ``` | ``` | ||||
| 2. Clone kode sumber dan instal dependensi Python: | 2. Clone kode sumber dan instal dependensi Python: | ||||
| git clone https://github.com/infiniflow/ragflow.git | git clone https://github.com/infiniflow/ragflow.git | ||||
| cd ragflow/ | cd ragflow/ | ||||
| uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | ||||
| pre-commit install | |||||
| ``` | ``` | ||||
| 3. Jalankan aplikasi yang diperlukan (MinIO, Elasticsearch, Redis, dan MySQL) menggunakan Docker Compose: | 3. Jalankan aplikasi yang diperlukan (MinIO, Elasticsearch, Redis, dan MySQL) menggunakan Docker Compose: |
| 1. uv をインストールする。すでにインストールされている場合は、このステップをスキップしてください: | 1. uv をインストールする。すでにインストールされている場合は、このステップをスキップしてください: | ||||
| ```bash | ```bash | ||||
| pipx install uv | |||||
| pipx install uv pre-commit | |||||
| ``` | ``` | ||||
| 2. ソースコードをクローンし、Python の依存関係をインストールする: | 2. ソースコードをクローンし、Python の依存関係をインストールする: | ||||
| git clone https://github.com/infiniflow/ragflow.git | git clone https://github.com/infiniflow/ragflow.git | ||||
| cd ragflow/ | cd ragflow/ | ||||
| uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | ||||
| pre-commit install | |||||
| ``` | ``` | ||||
| 3. Docker Compose を使用して依存サービス(MinIO、Elasticsearch、Redis、MySQL)を起動する: | 3. Docker Compose を使用して依存サービス(MinIO、Elasticsearch、Redis、MySQL)を起動する: |
| 1. uv를 설치하거나 이미 설치된 경우 이 단계를 건너뜁니다: | 1. uv를 설치하거나 이미 설치된 경우 이 단계를 건너뜁니다: | ||||
| ```bash | ```bash | ||||
| pipx install uv | |||||
| pipx install uv pre-commit | |||||
| ``` | ``` | ||||
| 2. 소스 코드를 클론하고 Python 의존성을 설치합니다: | 2. 소스 코드를 클론하고 Python 의존성을 설치합니다: | ||||
| git clone https://github.com/infiniflow/ragflow.git | git clone https://github.com/infiniflow/ragflow.git | ||||
| cd ragflow/ | cd ragflow/ | ||||
| uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | ||||
| pre-commit install | |||||
| ``` | ``` | ||||
| 3. Docker Compose를 사용하여 의존 서비스(MinIO, Elasticsearch, Redis 및 MySQL)를 시작합니다: | 3. Docker Compose를 사용하여 의존 서비스(MinIO, Elasticsearch, Redis 및 MySQL)를 시작합니다: |
| 1. Instale o `uv`, ou pule esta etapa se ele já estiver instalado: | 1. Instale o `uv`, ou pule esta etapa se ele já estiver instalado: | ||||
| ```bash | ```bash | ||||
| pipx install uv | |||||
| pipx install uv pre-commit | |||||
| ``` | ``` | ||||
| 2. Clone o código-fonte e instale as dependências Python: | 2. Clone o código-fonte e instale as dependências Python: | ||||
| git clone https://github.com/infiniflow/ragflow.git | git clone https://github.com/infiniflow/ragflow.git | ||||
| cd ragflow/ | cd ragflow/ | ||||
| uv sync --python 3.10 --all-extras # instala os módulos Python dependentes do RAGFlow | uv sync --python 3.10 --all-extras # instala os módulos Python dependentes do RAGFlow | ||||
| pre-commit install | |||||
| ``` | ``` | ||||
| 3. Inicie os serviços dependentes (MinIO, Elasticsearch, Redis e MySQL) usando Docker Compose: | 3. Inicie os serviços dependentes (MinIO, Elasticsearch, Redis e MySQL) usando Docker Compose: |
| 1. 安裝 uv。如已安裝,可跳過此步驟: | 1. 安裝 uv。如已安裝,可跳過此步驟: | ||||
| ```bash | ```bash | ||||
| pipx install uv | |||||
| pipx install uv pre-commit | |||||
| export UV_INDEX=https://mirrors.aliyun.com/pypi/simple | export UV_INDEX=https://mirrors.aliyun.com/pypi/simple | ||||
| ``` | ``` | ||||
| git clone https://github.com/infiniflow/ragflow.git | git clone https://github.com/infiniflow/ragflow.git | ||||
| cd ragflow/ | cd ragflow/ | ||||
| uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | ||||
| pre-commit install | |||||
| ``` | ``` | ||||
| 3. 透過 Docker Compose 啟動依賴的服務(MinIO, Elasticsearch, Redis, and MySQL): | 3. 透過 Docker Compose 啟動依賴的服務(MinIO, Elasticsearch, Redis, and MySQL): |
| 1. 安装 uv。如已经安装,可跳过本步骤: | 1. 安装 uv。如已经安装,可跳过本步骤: | ||||
| ```bash | ```bash | ||||
| pipx install uv | |||||
| pipx install uv pre-commit | |||||
| export UV_INDEX=https://mirrors.aliyun.com/pypi/simple | export UV_INDEX=https://mirrors.aliyun.com/pypi/simple | ||||
| ``` | ``` | ||||
| git clone https://github.com/infiniflow/ragflow.git | git clone https://github.com/infiniflow/ragflow.git | ||||
| cd ragflow/ | cd ragflow/ | ||||
| uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | uv sync --python 3.10 --all-extras # install RAGFlow dependent python modules | ||||
| pre-commit install | |||||
| ``` | ``` | ||||
| 3. 通过 Docker Compose 启动依赖的服务(MinIO, Elasticsearch, Redis, and MySQL): | 3. 通过 Docker Compose 启动依赖的服务(MinIO, Elasticsearch, Redis, and MySQL): |