From 14fbf594b260c46d229c371b9bfd45f0427c9612 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 7 Apr 2024 10:37:54 +0530 Subject: [PATCH 1/2] Support using Python 3.12 with Khoj - RapidOCR for indexing image PDFs doesn't currently support python 3.12. It's an optional dependency anyway, so only install it if python < 3.12 - Run unit tests with python version 3.12 as well Resolves #522 --- .github/workflows/test.yml | 1 + pyproject.toml | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51301491..d72f57df 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,6 +32,7 @@ jobs: - '3.9' - '3.10' - '3.11' + - '3.12' services: postgres: diff --git a/pyproject.toml b/pyproject.toml index 8a258580..e446a2a1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Internet :: WWW/HTTP :: Indexing/Search", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Human Machine Interfaces", @@ -47,12 +48,12 @@ dependencies = [ "tenacity >= 8.2.2", "pillow ~= 9.5.0", "pydantic >= 2.0.0", - "pyyaml == 6.0", + "pyyaml ~= 6.0", "rich >= 13.3.1", "schedule == 1.1.0", "sentence-transformers == 2.5.1", "transformers >= 4.28.0", - "torch == 2.0.1", + "torch == 2.2.2", "uvicorn == 0.17.6", "aiohttp ~= 3.9.0", "langchain <= 0.2.0", @@ -70,7 +71,7 @@ dependencies = [ "gunicorn == 21.2.0", "lxml == 4.9.3", "tzdata == 2023.3", - "rapidocr-onnxruntime == 1.3.11", + "rapidocr-onnxruntime == 1.3.11; python_version<'3.12'", "openai-whisper >= 20231117", "django-phonenumber-field == 7.3.0", "phonenumbers == 8.13.27", From e3deb29f8e3cc039712f92717b8579225597e8e0 Mon Sep 17 00:00:00 2001 From: Debanjum Singh Solanky Date: Sun, 7 Apr 2024 11:11:49 +0530 Subject: [PATCH 2/2] Upgrade khoj.el workflow to use Python 3.11 --- .github/workflows/build_khoj_el.yml | 4 ++-- .github/workflows/pre-commit.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_khoj_el.yml b/.github/workflows/build_khoj_el.yml index 9bf60ecc..54f626d6 100644 --- a/.github/workflows/build_khoj_el.yml +++ b/.github/workflows/build_khoj_el.yml @@ -21,9 +21,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.9 + - name: Set up Python 3.11 uses: actions/setup-python@v1 - with: { python-version: 3.9 } + with: { python-version: 3.11 } - name: ⏬️ Install Dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index a571e8a1..609dd601 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -31,7 +31,7 @@ jobs: with: fetch-depth: 0 - - name: Set up Python + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: python-version: 3.11