Skip to content

Commit

Permalink
Support using Python 3.12 with Khoj (#690)
Browse files Browse the repository at this point in the history
### Why
- Python 3.12 is the default Python on Ubuntu 24.04 LTS, Windows and Mac via Homebrew
- Python 3.12 has a bunch of improvements that can be explored with Khoj (e.g per core GIL for performance)

## Changes
- The latest PyTorch now supports Python 3.12
- RapidOCR for indexing image PDFs doesn't currently support python 3.12.
  But it's an optional dependency, so only install it if python < 3.12

### Testing
- Verified Khoj installs fine on Windows and Mac with Python 3.12
- Verified Khoj chat works fine on Mac, Windows with Python 3.12

Resolves #522
  • Loading branch information
debanjum authored Apr 8, 2024
2 parents 731ad03 + e3deb29 commit 4eda79c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_khoj_el.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
- '3.9'
- '3.10'
- '3.11'
- '3.12'

services:
postgres:
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 4eda79c

Please sign in to comment.