Bump python to >=3.12 (#11846)

### What problem does this PR solve?

Bump python to >=3.12

### Type of change

- [x] Refactoring
This commit is contained in:
Zhichang Yu
2025-12-09 19:55:25 +08:00
committed by GitHub
parent 65a5a56d95
commit f128a1fa9e
19 changed files with 402 additions and 865 deletions

View File

@ -126,7 +126,7 @@ jobs:
- name: Run unit test - name: Run unit test
run: | run: |
uv sync --python 3.11 --group test --frozen uv sync --python 3.12 --group test --frozen
source .venv/bin/activate source .venv/bin/activate
which pytest || echo "pytest not in PATH" which pytest || echo "pytest not in PATH"
echo "Start to run unit test" echo "Start to run unit test"
@ -198,7 +198,7 @@ jobs:
echo "HOST_ADDRESS=http://host.docker.internal:${SVR_HTTP_PORT}" >> ${GITHUB_ENV} echo "HOST_ADDRESS=http://host.docker.internal:${SVR_HTTP_PORT}" >> ${GITHUB_ENV}
sudo docker compose -f docker/docker-compose.yml -p ${GITHUB_RUN_ID} up -d sudo docker compose -f docker/docker-compose.yml -p ${GITHUB_RUN_ID} up -d
uv sync --python 3.11 --only-group test --no-default-groups --frozen && uv pip install sdk/python --group test uv sync --python 3.12 --only-group test --no-default-groups --frozen && uv pip install sdk/python --group test
- name: Run sdk tests against Elasticsearch - name: Run sdk tests against Elasticsearch
run: | run: |

View File

@ -34,7 +34,7 @@ The project uses **uv** for dependency management.
1. **Setup Environment**: 1. **Setup Environment**:
```bash ```bash
uv sync --python 3.11 --all-extras uv sync --python 3.12 --all-extras
uv run download_deps.py uv run download_deps.py
``` ```

View File

@ -45,7 +45,7 @@ RAGFlow is an open-source RAG (Retrieval-Augmented Generation) engine based on d
### Backend Development ### Backend Development
```bash ```bash
# Install Python dependencies # Install Python dependencies
uv sync --python 3.11 --all-extras uv sync --python 3.12 --all-extras
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install

View File

@ -1,5 +1,5 @@
# base stage # base stage
FROM ubuntu:22.04 AS base FROM ubuntu:24.04 AS base
USER root USER root
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
@ -33,16 +33,16 @@ ENV DEBIAN_FRONTEND=noninteractive
# selenium: libatk-bridge2.0-0 chrome-linux64-121-0-6167-85 # selenium: libatk-bridge2.0-0 chrome-linux64-121-0-6167-85
# Building C extensions: libpython3-dev libgtk-4-1 libnss3 xdg-utils libgbm-dev # Building C extensions: libpython3-dev libgtk-4-1 libnss3 xdg-utils libgbm-dev
RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
apt update && \
apt --no-install-recommends install -y ca-certificates; \
if [ "$NEED_MIRROR" == "1" ]; then \ if [ "$NEED_MIRROR" == "1" ]; then \
sed -i 's|http://ports.ubuntu.com|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list; \ sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' /etc/apt/sources.list.d/ubuntu.sources; \
sed -i 's|http://archive.ubuntu.com|http://mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list; \ sed -i 's|http://security.ubuntu.com/ubuntu|https://mirrors.tuna.tsinghua.edu.cn/ubuntu|g' /etc/apt/sources.list.d/ubuntu.sources; \
fi; \ fi; \
rm -f /etc/apt/apt.conf.d/docker-clean && \ rm -f /etc/apt/apt.conf.d/docker-clean && \
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \ echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache && \
chmod 1777 /tmp && \ chmod 1777 /tmp && \
apt update && \ apt update && \
apt --no-install-recommends install -y ca-certificates && \
apt update && \
apt install -y libglib2.0-0 libglx-mesa0 libgl1 && \ apt install -y libglib2.0-0 libglx-mesa0 libgl1 && \
apt install -y pkg-config libicu-dev libgdiplus && \ apt install -y pkg-config libicu-dev libgdiplus && \
apt install -y default-jdk && \ apt install -y default-jdk && \
@ -151,7 +151,7 @@ RUN --mount=type=cache,id=ragflow_uv,target=/root/.cache/uv,sharing=locked \
else \ else \
sed -i 's|pypi.tuna.tsinghua.edu.cn|pypi.org|g' uv.lock; \ sed -i 's|pypi.tuna.tsinghua.edu.cn|pypi.org|g' uv.lock; \
fi; \ fi; \
uv sync --python 3.11 --frozen uv sync --python 3.12 --frozen
COPY web web COPY web web
COPY docs docs COPY docs docs

View File

@ -314,7 +314,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
```bash ```bash
git clone https://github.com/infiniflow/ragflow.git git clone https://github.com/infiniflow/ragflow.git
cd ragflow/ cd ragflow/
uv sync --python 3.11 # install RAGFlow dependent python modules uv sync --python 3.12 # install RAGFlow dependent python modules
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install
``` ```

View File

@ -288,7 +288,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
```bash ```bash
git clone https://github.com/infiniflow/ragflow.git git clone https://github.com/infiniflow/ragflow.git
cd ragflow/ cd ragflow/
uv sync --python 3.11 # install RAGFlow dependent python modules uv sync --python 3.12 # install RAGFlow dependent python modules
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install
``` ```

View File

@ -288,7 +288,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
```bash ```bash
git clone https://github.com/infiniflow/ragflow.git git clone https://github.com/infiniflow/ragflow.git
cd ragflow/ cd ragflow/
uv sync --python 3.11 # install RAGFlow dependent python modules uv sync --python 3.12 # install RAGFlow dependent python modules
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install
``` ```

View File

@ -283,7 +283,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
```bash ```bash
git clone https://github.com/infiniflow/ragflow.git git clone https://github.com/infiniflow/ragflow.git
cd ragflow/ cd ragflow/
uv sync --python 3.11 # install RAGFlow dependent python modules uv sync --python 3.12 # install RAGFlow dependent python modules
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install
``` ```

View File

@ -305,7 +305,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
```bash ```bash
git clone https://github.com/infiniflow/ragflow.git git clone https://github.com/infiniflow/ragflow.git
cd ragflow/ cd ragflow/
uv sync --python 3.11 # instala os módulos Python dependentes do RAGFlow uv sync --python 3.12 # instala os módulos Python dependentes do RAGFlow
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install
``` ```

View File

@ -315,7 +315,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
```bash ```bash
git clone https://github.com/infiniflow/ragflow.git git clone https://github.com/infiniflow/ragflow.git
cd ragflow/ cd ragflow/
uv sync --python 3.11 # install RAGFlow dependent python modules uv sync --python 3.12 # install RAGFlow dependent python modules
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install
``` ```

View File

@ -315,7 +315,7 @@ docker build --platform linux/amd64 -f Dockerfile -t infiniflow/ragflow:nightly
```bash ```bash
git clone https://github.com/infiniflow/ragflow.git git clone https://github.com/infiniflow/ragflow.git
cd ragflow/ cd ragflow/
uv sync --python 3.11 # install RAGFlow dependent python modules uv sync --python 3.12 # install RAGFlow dependent python modules
uv run download_deps.py uv run download_deps.py
pre-commit install pre-commit install
``` ```

View File

@ -5,7 +5,7 @@ description = "Admin Service's client of [RAGFlow](https://github.com/infiniflow
authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }] authors = [{ name = "Lynn", email = "lynn_inf@hotmail.com" }]
license = { text = "Apache License, Version 2.0" } license = { text = "Apache License, Version 2.0" }
readme = "README.md" readme = "README.md"
requires-python = ">=3.10,<3.13" requires-python = ">=3.12,<3.15"
dependencies = [ dependencies = [
"requests>=2.30.0,<3.0.0", "requests>=2.30.0,<3.0.0",
"beartype>=0.20.0,<1.0.0", "beartype>=0.20.0,<1.0.0",

View File

@ -44,14 +44,14 @@ cd ragflow/
2. Install RAGFlow service's Python dependencies: 2. Install RAGFlow service's Python dependencies:
```bash ```bash
uv sync --python 3.11 --frozen uv sync --python 3.12 --frozen
``` ```
*A virtual environment named `.venv` is created, and all Python dependencies are installed into the new environment.* *A virtual environment named `.venv` is created, and all Python dependencies are installed into the new environment.*
If you need to run tests against the RAGFlow service, install the test dependencies: If you need to run tests against the RAGFlow service, install the test dependencies:
```bash ```bash
uv sync --python 3.11 --group test --frozen && uv pip install sdk/python --group test uv sync --python 3.12 --group test --frozen && uv pip install sdk/python --group test
``` ```
### Launch third-party services ### Launch third-party services

View File

@ -176,7 +176,7 @@ This section is contributed by our community contributor [yiminghub2024](https:/
iii. Copy [docker/entrypoint.sh](https://github.com/infiniflow/ragflow/blob/main/docker/entrypoint.sh) locally. iii. Copy [docker/entrypoint.sh](https://github.com/infiniflow/ragflow/blob/main/docker/entrypoint.sh) locally.
iv. Install the required dependencies using `uv`: iv. Install the required dependencies using `uv`:
- Run `uv add mcp` or - Run `uv add mcp` or
- Copy [pyproject.toml](https://github.com/infiniflow/ragflow/blob/main/pyproject.toml) locally and run `uv sync --python 3.11`. - Copy [pyproject.toml](https://github.com/infiniflow/ragflow/blob/main/pyproject.toml) locally and run `uv sync --python 3.12`.
2. Edit **docker-compose.yml** to enable MCP (disabled by default). 2. Edit **docker-compose.yml** to enable MCP (disabled by default).
3. Launch the MCP server: 3. Launch the MCP server:

View File

@ -5,7 +5,7 @@ description = "[RAGFlow](https://ragflow.io/) is an open-source RAG (Retrieval-A
authors = [{ name = "Zhichang Yu", email = "yuzhichang@gmail.com" }] authors = [{ name = "Zhichang Yu", email = "yuzhichang@gmail.com" }]
license-files = ["LICENSE"] license-files = ["LICENSE"]
readme = "README.md" readme = "README.md"
requires-python = ">=3.11,<3.15" requires-python = ">=3.12,<3.15"
dependencies = [ dependencies = [
"datrie>=0.8.3,<0.9.0", "datrie>=0.8.3,<0.9.0",
"akshare>=1.15.78,<2.0.0", "akshare>=1.15.78,<2.0.0",
@ -25,7 +25,7 @@ dependencies = [
"chardet==5.2.0", "chardet==5.2.0",
"cn2an==0.5.22", "cn2an==0.5.22",
"cohere==5.6.2", "cohere==5.6.2",
"Crawl4AI>=0.3.8", "Crawl4AI>=0.4.0,<1.0.0",
"dashscope==1.20.11", "dashscope==1.20.11",
"deepl==1.18.0", "deepl==1.18.0",
"demjson3==3.0.6", "demjson3==3.0.6",
@ -63,8 +63,8 @@ dependencies = [
"numpy>=1.26.0,<2.0.0", "numpy>=1.26.0,<2.0.0",
"Office365-REST-Python-Client==2.6.2", "Office365-REST-Python-Client==2.6.2",
"ollama>=0.5.0", "ollama>=0.5.0",
"onnxruntime==1.19.2; sys_platform == 'darwin' or platform_machine != 'x86_64'", "onnxruntime==1.23.2; sys_platform == 'darwin' or platform_machine != 'x86_64'",
"onnxruntime-gpu==1.19.2; sys_platform != 'darwin' and platform_machine == 'x86_64'", "onnxruntime-gpu==1.23.2; sys_platform != 'darwin' and platform_machine == 'x86_64'",
"openai>=1.45.0", "openai>=1.45.0",
"opencv-python==4.10.0.84", "opencv-python==4.10.0.84",
"opencv-python-headless==4.10.0.84", "opencv-python-headless==4.10.0.84",
@ -74,23 +74,23 @@ dependencies = [
"pandas>=2.2.0,<3.0.0", "pandas>=2.2.0,<3.0.0",
"pdfplumber==0.10.4", "pdfplumber==0.10.4",
"peewee==3.17.1", "peewee==3.17.1",
"pillow==10.4.0", "pillow>=10.4.0,<13.0.0",
"protobuf==5.27.2", "protobuf==5.27.2",
"psycopg2-binary==2.9.9", "psycopg2-binary>=2.9.11,<3.0.0",
"pyclipper==1.3.0.post5", "pyclipper>=1.4.0,<2.0.0",
"pycryptodomex==3.20.0", "pycryptodomex==3.20.0",
"pymysql>=1.1.1,<2.0.0", "pymysql>=1.1.1,<2.0.0",
"pypdf==6.4.0", "pypdf==6.4.0",
"python-dotenv==1.0.1", "python-dotenv==1.0.1",
"python-dateutil==2.8.2", "python-dateutil==2.8.2",
"python-pptx>=1.0.2,<2.0.0", "python-pptx>=1.0.2,<2.0.0",
"pywencai==0.12.2", "pywencai>=0.13.1,<1.0.0",
"qianfan==0.4.6", "qianfan==0.4.6",
"quart-auth==0.11.0", "quart-auth==0.11.0",
"quart-cors==0.8.0", "quart-cors==0.8.0",
"Quart==0.20.0", "Quart==0.20.0",
"ranx==0.3.20", "ranx==0.3.20",
"readability-lxml==0.8.1", "readability-lxml>=0.8.4,<1.0.0",
"valkey==6.0.2", "valkey==6.0.2",
"requests>=2.32.3,<3.0.0", "requests>=2.32.3,<3.0.0",
"replicate==0.31.0", "replicate==0.31.0",
@ -160,7 +160,7 @@ dependencies = [
test = [ test = [
"hypothesis>=6.132.0", "hypothesis>=6.132.0",
"openpyxl>=3.1.5", "openpyxl>=3.1.5",
"pillow>=10.4.0", "pillow>=10.4.0,<13.0.0",
"pytest>=8.3.5", "pytest>=8.3.5",
"pytest-asyncio>=1.3.0", "pytest-asyncio>=1.3.0",
"pytest-xdist>=3.8.0", "pytest-xdist>=3.8.0",

View File

@ -32,7 +32,7 @@ all: setup start
# 🌱 Initialize environment + install dependencies # 🌱 Initialize environment + install dependencies
setup: ensure_env ensure_uv setup: ensure_env ensure_uv
@echo "📦 Installing dependencies with uv..." @echo "📦 Installing dependencies with uv..."
@$(UV) sync --python 3.11 @$(UV) sync --python 3.12
source $(ACTIVATE_SCRIPT) && \ source $(ACTIVATE_SCRIPT) && \
export PYTHONPATH=$(PYTHONPATH) export PYTHONPATH=$(PYTHONPATH)
@$(UV) pip install -r executor_manager/requirements.txt @$(UV) pip install -r executor_manager/requirements.txt

View File

@ -3,7 +3,7 @@ name = "gvisor-sandbox"
version = "0.1.0" version = "0.1.0"
description = "Add your description here" description = "Add your description here"
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.12,<3.15"
dependencies = [ dependencies = [
"fastapi>=0.115.12", "fastapi>=0.115.12",
"httpx>=0.28.1", "httpx>=0.28.1",

View File

@ -5,7 +5,7 @@ description = "Python client sdk of [RAGFlow](https://github.com/infiniflow/ragf
authors = [{ name = "Zhichang Yu", email = "yuzhichang@gmail.com" }] authors = [{ name = "Zhichang Yu", email = "yuzhichang@gmail.com" }]
license = { text = "Apache License, Version 2.0" } license = { text = "Apache License, Version 2.0" }
readme = "README.md" readme = "README.md"
requires-python = ">=3.10,<3.13" requires-python = ">=3.12,<3.15"
dependencies = ["requests>=2.30.0,<3.0.0", "beartype>=0.20.0,<1.0.0"] dependencies = ["requests>=2.30.0,<3.0.0", "beartype>=0.20.0,<1.0.0"]

1199
uv.lock generated

File diff suppressed because it is too large Load Diff