diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 92fbc56b..4c19a678 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -60,10 +60,10 @@ jobs: with: persist-credentials: false - - name: Setup python 3.11 + - name: Setup python 3.13 uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 with: - python-version: '3.11' + python-version: '3.13' cache: 'pip' cache-dependency-path: | requirements.txt diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c4a00218..60881901 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -53,10 +53,10 @@ jobs: with: persist-credentials: false - - name: Setup python 3.11 + - name: Setup python 3.13 uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5 with: - python-version: '3.11' + python-version: '3.13' # The repair runner only depends on the standard library, so the heavy # runtime requirements are deliberately not installed here. diff --git a/Dockerfile b/Dockerfile index 3418ddeb..f4d6f5c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,16 @@ # ARG UBUNTU_VERSION=24.04 ARG CUDA_VERSION=12.8.2 -ARG LLAMA_CPP_PYTHON_VERSION=0.3.23 +ARG LLAMA_CPP_PYTHON_VERSION=0.3.36 +# torch comes from a per-flavour index, so requirements.txt's torch lines are +# dropped in the runtime stages. TORCH_VERSION matches requirements.txt; the cu128 +# index has nothing newer than CUDA_TORCH_VERSION. +ARG TORCH_VERSION=2.14.1 +ARG TORCHVISION_VERSION=0.29.1 +ARG CUDA_TORCH_VERSION=2.11.0 +ARG CUDA_TORCHVISION_VERSION=0.26.0 +ARG CUDA_TORCH_INDEX=cu128 +ARG ROCM_TORCH_INDEX=rocm7.14 ARG BASE_IMAGE=ubuntu:${UBUNTU_VERSION} ARG CUDA_DEVEL_IMAGE=nvidia/cuda:${CUDA_VERSION}-devel-ubuntu${UBUNTU_VERSION} @@ -27,18 +36,18 @@ ARG LLAMA_CPP_PYTHON_VERSION ENV DEBIAN_FRONTEND=noninteractive WORKDIR /build -ADD dockerfile_scripts/install_py11.sh dockerfile_scripts/install_py11.sh -RUN ./dockerfile_scripts/install_py11.sh +ADD dockerfile_scripts/install_py.sh dockerfile_scripts/install_py.sh +RUN ./dockerfile_scripts/install_py.sh # gcc-14: Ubuntu 24.04 ships gcc-13 by default; gcc-14 is used for # consistency across all builder stages and better C++23 support. RUN apt-get install -y --no-install-recommends \ - python3.11-dev \ + python3.13-dev \ cmake build-essential ninja-build git \ gcc-14 g++-14 \ libgomp1 \ && rm -rf /var/lib/apt/lists/* -RUN /usr/bin/python3.11 -m venv /opt/venv \ +RUN /usr/bin/python3.13 -m venv /opt/venv \ && /opt/venv/bin/python -m pip install --no-cache-dir --upgrade pip setuptools wheel ENV CC=gcc-14 CXX=g++-14 @@ -73,16 +82,16 @@ ARG LLAMA_CPP_PYTHON_VERSION ENV DEBIAN_FRONTEND=noninteractive WORKDIR /build -ADD dockerfile_scripts/install_py11.sh dockerfile_scripts/install_py11.sh -RUN ./dockerfile_scripts/install_py11.sh +ADD dockerfile_scripts/install_py.sh dockerfile_scripts/install_py.sh +RUN ./dockerfile_scripts/install_py.sh RUN apt-get install -y --no-install-recommends \ - python3.11-dev \ + python3.13-dev \ cmake build-essential ninja-build git \ gcc-14 g++-14 \ libgomp1 \ && rm -rf /var/lib/apt/lists/* -RUN /usr/bin/python3.11 -m venv /opt/venv \ +RUN /usr/bin/python3.13 -m venv /opt/venv \ && /opt/venv/bin/python -m pip install --no-cache-dir --upgrade pip setuptools wheel # Make the CUDA compat stub visible to the linker for both executables and shared libs @@ -117,19 +126,19 @@ ARG LLAMA_CPP_PYTHON_VERSION ENV DEBIAN_FRONTEND=noninteractive WORKDIR /build -ADD dockerfile_scripts/install_py11.sh dockerfile_scripts/install_py11.sh -RUN ./dockerfile_scripts/install_py11.sh +ADD dockerfile_scripts/install_py.sh dockerfile_scripts/install_py.sh +RUN ./dockerfile_scripts/install_py.sh # Vulkan headers + glslc (shader compiler) are build-time only RUN apt-get update \ && apt-get install -y --no-install-recommends \ - python3.11-dev \ + python3.13-dev \ cmake build-essential ninja-build git \ gcc-14 g++-14 \ libgomp1 \ libvulkan-dev glslc spirv-headers \ && rm -rf /var/lib/apt/lists/* -RUN /usr/bin/python3.11 -m venv /opt/venv \ +RUN /usr/bin/python3.13 -m venv /opt/venv \ && /opt/venv/bin/python -m pip install --no-cache-dir --upgrade pip setuptools wheel ENV CC=gcc-14 CXX=g++-14 @@ -147,6 +156,8 @@ RUN /opt/venv/bin/python -m pip wheel \ # CPU / ARM runtime # ============================================================ FROM ${BASE_IMAGE} AS runtime-cpu +ARG TORCH_VERSION +ARG TORCHVISION_VERSION ARG CCB_DB_NAME=ccb ARG CCB_DB_USER=ccbuser @@ -161,28 +172,31 @@ WORKDIR /app ADD dockerfile_scripts/install_deps.sh dockerfile_scripts/install_deps.sh RUN ./dockerfile_scripts/install_deps.sh -ADD dockerfile_scripts/install_py11.sh dockerfile_scripts/install_py11.sh -RUN ./dockerfile_scripts/install_py11.sh +ADD dockerfile_scripts/install_py.sh dockerfile_scripts/install_py.sh +RUN ./dockerfile_scripts/install_py.sh ADD dockerfile_scripts/pgsql dockerfile_scripts/pgsql RUN ./dockerfile_scripts/pgsql/install.sh ADD dockerfile_scripts/install_frpc.sh dockerfile_scripts/install_frpc.sh RUN ./dockerfile_scripts/install_frpc.sh -RUN apt-get autoclean +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get autoclean \ + && rm -rf /var/lib/apt/lists/* ADD dockerfile_scripts/entrypoint.sh dockerfile_scripts/entrypoint.sh ENV DEBIAN_FRONTEND=dialog # Install llama_cpp_python from the CPU builder wheel COPY --from=llama-builder-cpu /wheels /wheels -RUN /usr/bin/python3.11 -m venv /opt/venv \ +RUN /usr/bin/python3.13 -m venv /opt/venv \ && /opt/venv/bin/python -m pip install --no-cache-dir --upgrade pip setuptools wheel \ && /opt/venv/bin/python -m pip install --no-cache-dir --no-index --find-links=/wheels llama-cpp-python \ - && /opt/venv/bin/python -m pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu \ + && /opt/venv/bin/python -m pip install --no-cache-dir "torch==${TORCH_VERSION}" "torchvision==${TORCHVISION_VERSION}" --index-url https://download.pytorch.org/whl/cpu \ && rm -rf /wheels \ && /opt/venv/bin/python -m pip cache purge COPY requirements.txt . -RUN sed -i '/^llama_cpp_python/d' requirements.txt \ +RUN sed -Ei '/^(llama_cpp_python|torch|torchvision)[[:space:]]*[><=~!]/d' requirements.txt \ && /opt/venv/bin/python -m pip install --no-cache-dir -r requirements.txt \ && /opt/venv/bin/python -m pip cache purge @@ -201,6 +215,9 @@ ENTRYPOINT ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] # CUDA (NVIDIA GPU) runtime # ============================================================ FROM ${CUDA_RUNTIME_IMAGE} AS runtime-cuda +ARG CUDA_TORCH_VERSION +ARG CUDA_TORCHVISION_VERSION +ARG CUDA_TORCH_INDEX ARG CCB_DB_NAME=ccb ARG CCB_DB_USER=ccbuser @@ -217,13 +234,16 @@ WORKDIR /app ADD dockerfile_scripts/install_deps.sh dockerfile_scripts/install_deps.sh RUN ./dockerfile_scripts/install_deps.sh -ADD dockerfile_scripts/install_py11.sh dockerfile_scripts/install_py11.sh -RUN ./dockerfile_scripts/install_py11.sh +ADD dockerfile_scripts/install_py.sh dockerfile_scripts/install_py.sh +RUN ./dockerfile_scripts/install_py.sh ADD dockerfile_scripts/pgsql dockerfile_scripts/pgsql RUN ./dockerfile_scripts/pgsql/install.sh ADD dockerfile_scripts/install_frpc.sh dockerfile_scripts/install_frpc.sh RUN ./dockerfile_scripts/install_frpc.sh -RUN apt-get autoclean +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get autoclean \ + && rm -rf /var/lib/apt/lists/* ADD dockerfile_scripts/entrypoint.sh dockerfile_scripts/entrypoint.sh ENV DEBIAN_FRONTEND=dialog @@ -234,14 +254,17 @@ RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/lib/libcuda.so \ ENV LD_LIBRARY_PATH="/usr/local/lib:/usr/local/cuda/lib64:/usr/local/cuda/lib64/stubs:${LD_LIBRARY_PATH}" COPY --from=llama-builder-cuda /wheels /wheels -RUN /usr/bin/python3.11 -m venv /opt/venv \ +# torch from PyPI bundles CUDA 13 libraries, which need a newer driver than the +# CUDA 12.8 base image targets, so it comes from CUDA_TORCH_INDEX instead +RUN /usr/bin/python3.13 -m venv /opt/venv \ && /opt/venv/bin/python -m pip install --no-cache-dir --upgrade pip setuptools wheel \ && /opt/venv/bin/python -m pip install --no-cache-dir --no-index --find-links=/wheels llama-cpp-python \ + && /opt/venv/bin/python -m pip install --no-cache-dir "torch==${CUDA_TORCH_VERSION}" "torchvision==${CUDA_TORCHVISION_VERSION}" --index-url "https://download.pytorch.org/whl/${CUDA_TORCH_INDEX}" \ && rm -rf /wheels \ && /opt/venv/bin/python -m pip cache purge COPY requirements.txt . -RUN sed -i '/^llama_cpp_python/d' requirements.txt \ +RUN sed -Ei '/^(llama_cpp_python|torch|torchvision)[[:space:]]*[><=~!]/d' requirements.txt \ && /opt/venv/bin/python -m pip install --no-cache-dir -r requirements.txt \ && /opt/venv/bin/python -m pip cache purge @@ -263,6 +286,10 @@ ENTRYPOINT ["supervisord", "-c", "/etc/supervisor/supervisord.conf"] # GCN, RDNA1/2/3 and newer AMD GPUs out of the box. # ============================================================ FROM ${BASE_IMAGE} AS runtime-vulkan +ARG TARGETARCH +ARG TORCH_VERSION +ARG TORCHVISION_VERSION +ARG ROCM_TORCH_INDEX ARG CCB_DB_NAME=ccb ARG CCB_DB_USER=ccbuser @@ -277,13 +304,16 @@ WORKDIR /app ADD dockerfile_scripts/install_deps.sh dockerfile_scripts/install_deps.sh RUN ./dockerfile_scripts/install_deps.sh -ADD dockerfile_scripts/install_py11.sh dockerfile_scripts/install_py11.sh -RUN ./dockerfile_scripts/install_py11.sh +ADD dockerfile_scripts/install_py.sh dockerfile_scripts/install_py.sh +RUN ./dockerfile_scripts/install_py.sh ADD dockerfile_scripts/pgsql dockerfile_scripts/pgsql RUN ./dockerfile_scripts/pgsql/install.sh ADD dockerfile_scripts/install_frpc.sh dockerfile_scripts/install_frpc.sh RUN ./dockerfile_scripts/install_frpc.sh -RUN apt-get autoclean +RUN apt-get update \ + && apt-get upgrade -y \ + && apt-get autoclean \ + && rm -rf /var/lib/apt/lists/* ADD dockerfile_scripts/entrypoint.sh dockerfile_scripts/entrypoint.sh # Install Vulkan runtime + AMD RADV open-source driver @@ -296,14 +326,17 @@ ENV DEBIAN_FRONTEND=dialog # Install llama_cpp_python from the Vulkan builder wheel COPY --from=llama-builder-vulkan /wheels /wheels -RUN /usr/bin/python3.11 -m venv /opt/venv \ +# ROCm torch is only published for x86_64; arm64 gets the CPU build +RUN if [ "$TARGETARCH" = "amd64" ]; then TORCH_INDEX="$ROCM_TORCH_INDEX"; else TORCH_INDEX=cpu; fi \ + && /usr/bin/python3.13 -m venv /opt/venv \ && /opt/venv/bin/python -m pip install --no-cache-dir --upgrade pip setuptools wheel \ && /opt/venv/bin/python -m pip install --no-cache-dir --no-index --find-links=/wheels llama-cpp-python \ + && /opt/venv/bin/python -m pip install --no-cache-dir "torch==${TORCH_VERSION}" "torchvision==${TORCHVISION_VERSION}" --index-url "https://download.pytorch.org/whl/${TORCH_INDEX}" \ && rm -rf /wheels \ && /opt/venv/bin/python -m pip cache purge COPY requirements.txt . -RUN sed -i '/^llama_cpp_python/d' requirements.txt \ +RUN sed -Ei '/^(llama_cpp_python|torch|torchvision)[[:space:]]*[><=~!]/d' requirements.txt \ && /opt/venv/bin/python -m pip install --no-cache-dir -r requirements.txt \ && /opt/venv/bin/python -m pip cache purge diff --git a/context_chat_backend/chain/context.py b/context_chat_backend/chain/context.py index 81a58f97..d5712abb 100644 --- a/context_chat_backend/chain/context.py +++ b/context_chat_backend/chain/context.py @@ -4,7 +4,7 @@ # import logging -from langchain.schema import Document +from langchain_core.documents import Document from ..dyn_loader import VectorDBLoader from ..vectordb.base import BaseVectorDB diff --git a/context_chat_backend/chain/ingest/doc_splitter.py b/context_chat_backend/chain/ingest/doc_splitter.py index 8703d5d0..4fda2ab4 100644 --- a/context_chat_backend/chain/ingest/doc_splitter.py +++ b/context_chat_backend/chain/ingest/doc_splitter.py @@ -4,7 +4,7 @@ # from functools import lru_cache -from langchain.text_splitter import MarkdownTextSplitter, RecursiveCharacterTextSplitter, TextSplitter +from langchain_text_splitters import MarkdownTextSplitter, RecursiveCharacterTextSplitter, TextSplitter @lru_cache(maxsize=32) diff --git a/context_chat_backend/chain/ingest/injest.py b/context_chat_backend/chain/ingest/injest.py index 53de7f45..25a4d6d3 100644 --- a/context_chat_backend/chain/ingest/injest.py +++ b/context_chat_backend/chain/ingest/injest.py @@ -11,7 +11,7 @@ from time import perf_counter_ns import niquests -from langchain.schema import Document +from langchain_core.documents import Document from nc_py_api import AsyncNextcloudApp from nc_py_api._exceptions import NextcloudException from pydantic import ValidationError diff --git a/context_chat_backend/chain/one_shot.py b/context_chat_backend/chain/one_shot.py index 7f37fc26..66bfd629 100644 --- a/context_chat_backend/chain/one_shot.py +++ b/context_chat_backend/chain/one_shot.py @@ -4,7 +4,7 @@ # import logging -from langchain.llms.base import LLM +from langchain_core.language_models.llms import LLM from ..dyn_loader import VectorDBLoader from ..types import TConfig diff --git a/context_chat_backend/chain/query_proc.py b/context_chat_backend/chain/query_proc.py index 1fe68270..fc927419 100644 --- a/context_chat_backend/chain/query_proc.py +++ b/context_chat_backend/chain/query_proc.py @@ -6,8 +6,8 @@ import os from sys import maxsize as SYS_MAXSIZE -from langchain.llms.base import LLM -from langchain.schema import Document +from langchain_core.documents import Document +from langchain_core.language_models.llms import LLM from transformers import GPT2Tokenizer from ..types import TConfig diff --git a/context_chat_backend/chain/types.py b/context_chat_backend/chain/types.py index 3afdf297..b45d79ab 100644 --- a/context_chat_backend/chain/types.py +++ b/context_chat_backend/chain/types.py @@ -4,7 +4,7 @@ # from enum import Enum -from langchain.schema import Document +from langchain_core.documents import Document from pydantic import BaseModel from typing_extensions import TypedDict diff --git a/context_chat_backend/dyn_loader.py b/context_chat_backend/dyn_loader.py index e3b43191..d6e3e398 100644 --- a/context_chat_backend/dyn_loader.py +++ b/context_chat_backend/dyn_loader.py @@ -9,7 +9,7 @@ from typing import Any import torch -from langchain.llms.base import LLM +from langchain_core.language_models.llms import LLM from .models.loader import init_model from .network_em import NetworkEmbeddings diff --git a/context_chat_backend/models/hugging_face.py b/context_chat_backend/models/hugging_face.py index 2ae03c55..d7dacded 100644 --- a/context_chat_backend/models/hugging_face.py +++ b/context_chat_backend/models/hugging_face.py @@ -5,7 +5,7 @@ import logging from os import getenv, path -from langchain_community.llms.huggingface_pipeline import HuggingFacePipeline +from langchain_huggingface import HuggingFacePipeline logger = logging.getLogger('ccb.models') diff --git a/context_chat_backend/models/loader.py b/context_chat_backend/models/loader.py index 3aa1416d..f12a4a36 100644 --- a/context_chat_backend/models/loader.py +++ b/context_chat_backend/models/loader.py @@ -5,8 +5,8 @@ from collections.abc import Callable from importlib import import_module -from langchain.llms.base import LLM -from langchain.schema.embeddings import Embeddings +from langchain_core.embeddings import Embeddings +from langchain_core.language_models.llms import LLM _llm_models = ["nc_texttotext", "llama", "hugging_face", "ctransformer"] diff --git a/context_chat_backend/task_fetcher.py b/context_chat_backend/task_fetcher.py index 2b0a5a5b..86adcb0f 100644 --- a/context_chat_backend/task_fetcher.py +++ b/context_chat_backend/task_fetcher.py @@ -14,7 +14,7 @@ from typing import Any import niquests -from langchain.llms.base import LLM +from langchain_core.language_models.llms import LLM from nc_py_api import NextcloudApp, NextcloudException from niquests import JSONDecodeError, RequestException from pydantic import ValidationError diff --git a/context_chat_backend/utils.py b/context_chat_backend/utils.py index d5727140..86bc8274 100644 --- a/context_chat_backend/utils.py +++ b/context_chat_backend/utils.py @@ -15,22 +15,21 @@ from functools import partial, wraps from multiprocessing.connection import Connection from time import perf_counter_ns -from typing import Any, TypeGuard, TypeVar +from typing import Any, TypeGuard from fastapi.responses import JSONResponse as FastAPIJSONResponse from .types import AppRole, TConfig, TEmbeddingAuthApiKey, TEmbeddingAuthBasic, TEmbeddingConfig -T = TypeVar('T') _logger = logging.getLogger('ccb.utils') _MAX_STD_CAPTURE_CHARS = 64 * 1024 -def not_none(value: T | None) -> TypeGuard[T]: +def not_none[T](value: T | None) -> TypeGuard[T]: return value is not None -def value_of(value: T, default: T | None = None) -> T | None: +def value_of[T](value: T, default: T | None = None) -> T | None: if value is None: return default diff --git a/context_chat_backend/vectordb/base.py b/context_chat_backend/vectordb/base.py index 2b4aa35e..60e65f7b 100644 --- a/context_chat_backend/vectordb/base.py +++ b/context_chat_backend/vectordb/base.py @@ -6,9 +6,9 @@ from collections.abc import Mapping from typing import Any -from langchain.schema import Document -from langchain.schema.embeddings import Embeddings -from langchain.schema.vectorstore import VectorStore +from langchain_core.documents import Document +from langchain_core.embeddings import Embeddings +from langchain_core.vectorstores import VectorStore from ..chain.types import InDocument, ScopeType from ..types import IndexingError, ReceivedFileItem, SourceItem diff --git a/context_chat_backend/vectordb/pgvector.py b/context_chat_backend/vectordb/pgvector.py index 382baff0..30c18dd9 100644 --- a/context_chat_backend/vectordb/pgvector.py +++ b/context_chat_backend/vectordb/pgvector.py @@ -13,9 +13,9 @@ import sqlalchemy.dialects.postgresql as postgresql_dialects import sqlalchemy.orm as orm from dotenv import load_dotenv -from langchain.schema import Document -from langchain.vectorstores import VectorStore +from langchain_core.documents import Document from langchain_core.embeddings import Embeddings +from langchain_core.vectorstores import VectorStore from langchain_postgres.vectorstores import Base, PGVector from ..chain.types import InDocument, ScopeType diff --git a/dockerfile_scripts/install_frpc.sh b/dockerfile_scripts/install_frpc.sh index 2230a898..30f74d6d 100755 --- a/dockerfile_scripts/install_frpc.sh +++ b/dockerfile_scripts/install_frpc.sh @@ -4,18 +4,40 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # -# Download and install FRP client -set -ex; \ - ARCH=$(uname -m); \ - if [ "$ARCH" = "aarch64" ]; then \ - FRP_URL="https://raw.githubusercontent.com/nextcloud/HaRP/dadcb7cfeb7a6d058ca2acb5622807269239f369/exapps_dev/frp_0.61.1_linux_arm64.tar.gz"; \ - else \ - FRP_URL="https://raw.githubusercontent.com/nextcloud/HaRP/dadcb7cfeb7a6d058ca2acb5622807269239f369/exapps_dev/frp_0.61.1_linux_amd64.tar.gz"; \ - fi; \ - echo "Downloading FRP client from $FRP_URL"; \ - curl -L "$FRP_URL" -o /tmp/frp.tar.gz; \ - tar -C /tmp -xzf /tmp/frp.tar.gz; \ - mv /tmp/frp_0.61.1_linux_* /tmp/frp; \ - cp /tmp/frp/frpc /usr/local/bin/frpc; \ - chmod +x /usr/local/bin/frpc; \ - rm -rf /tmp/frp /tmp/frp.tar.gz +# Download and install the FRP client from the upstream release, verified against +# pinned checksums, as described in +# https://github.com/nextcloud/HaRP#adapting-exapps-to-use-harp +# When upgrading, update the version and copy both linux checksums from that +# release's frp_sha256_checksums.txt. +FRP_VERSION=0.71.0 +FRP_AMD64_SHA256=84f27e39f11169f7adcef8e8b70c9329de17747b1f14dad9fb95eef5682ea716 +FRP_ARM64_SHA256=f33c293c275d8fc68c654b6fba8f10b2551d6463d09a9fc9cffb7227eae82266 + +set -ex + +ARCH=$(uname -m) +if [ "$ARCH" = "aarch64" ]; then + FRP_ARCH="arm64" + FRP_SHA256="${FRP_ARM64_SHA256}" +else + FRP_ARCH="amd64" + FRP_SHA256="${FRP_AMD64_SHA256}" +fi + +FRP_URL="https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_${FRP_ARCH}.tar.gz" +echo "Downloading FRP v${FRP_VERSION} for ${FRP_ARCH}..." +curl -fsSL "${FRP_URL}" -o /tmp/frp.tar.gz + +ACTUAL_SHA256=$(sha256sum /tmp/frp.tar.gz | cut -d' ' -f1) +if [ "$ACTUAL_SHA256" != "$FRP_SHA256" ]; then + echo "Checksum verification failed for FRP v${FRP_VERSION} (${FRP_ARCH})" + echo "Expected: ${FRP_SHA256}" + echo "Got: ${ACTUAL_SHA256}" + exit 1 +fi + +tar -C /tmp -xzf /tmp/frp.tar.gz +cp "/tmp/frp_${FRP_VERSION}_linux_${FRP_ARCH}/frpc" /usr/local/bin/frpc +chmod +x /usr/local/bin/frpc +rm -rf "/tmp/frp_${FRP_VERSION}_linux_${FRP_ARCH}" /tmp/frp.tar.gz +echo "FRP client installed successfully" diff --git a/dockerfile_scripts/install_py11.sh b/dockerfile_scripts/install_py.sh similarity index 81% rename from dockerfile_scripts/install_py11.sh rename to dockerfile_scripts/install_py.sh index e8e58702..11ca2bfa 100755 --- a/dockerfile_scripts/install_py11.sh +++ b/dockerfile_scripts/install_py.sh @@ -7,5 +7,5 @@ apt-get update apt-get install -y software-properties-common add-apt-repository -y ppa:deadsnakes/ppa apt-get update -apt-get install -y --no-install-recommends python3.11 python3.11-venv python3-pip -update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 +apt-get install -y --no-install-recommends python3.13 python3.13-venv python3-pip +update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 1 diff --git a/pyproject.toml b/pyproject.toml index 7e93ac89..8c8277af 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ [project] name = "context_chat_backend" version = "5.5.0-beta1" -requires-python = ">=3.11" +requires-python = ">=3.13" authors = [ { name = "Anupam Kumar", email = "kyteinsky@gmail.com" } ] @@ -22,7 +22,7 @@ pythonpath = ["."] addopts = "-ra --strict-markers --strict-config" [tool.ruff] -target-version = "py311" +target-version = "py313" include = ["context_chat_backend/**/*.py", "main.py", "tests/**/*.py"] line-length = 120 fix = true @@ -51,7 +51,7 @@ fixable = [ [tool.pyright] include = ["context_chat_backend/**/*.py", "main.py", "main_em.py", "tests/**/*.py"] -pythonVersion = "3.11" +pythonVersion = "3.13" pythonPlatform = "Linux" [tool.isort] diff --git a/requirements.txt b/requirements.txt index 5440e963..0240a1da 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,39 +1,42 @@ -apscheduler>=3.11.1 -chromadb>=1.3.5 -cryptography>=46.0.3 +apscheduler>=3.11.3 +chromadb>=1.5.9 +cryptography>=50.0.2 ctransformers>=0.2.27 docx2txt>=0.9 epub2txt>=0.1.6 -fastapi>=0.122.0 -niquests>=3.17.0 -# fix the langchain package versions to avoid long computation in pip dep resolution -# langchain is stuck at <1.0.0 due to langhchain-unstructured not being updated yet -langchain==0.3.27 -langchain-community==0.3.21 -langchain-postgres==0.0.16 -langchain-unstructured==0.1.6 -llama_cpp_python>=0.3.16 +fastapi>=0.143.0 +niquests>=3.21.2 +langchain-community>=0.4.2 +langchain-core>=1.6.10 +langchain-huggingface>=1.2.3 +langchain-postgres>=0.0.19 +langchain-text-splitters>=1.1.3 +langchain-unstructured>=1.0.1 +llama_cpp_python>=0.3.36 msg-parser>=1.2.0 -nc_py_api>=0.24.0 -odfdo>=3.17.6 +nc_py_api>=0.30.3 +odfdo>=3.27.1 odfpy>=1.4.1 openpyxl>=3.1.5 -pandas>=2.3.3 -psutil>=7.1.3 -pypdf>=6.4.0 -protobuf>=6.33.1 -python-dotenv>=1.2.1 -python-multipart>=0.0.20 +pandas>=3.0.6 +psutil>=7.2.2 +pypdf>=6.20.0 +protobuf>=7.36.2 +python-dotenv>=1.2.4 +python-multipart>=0.0.32 python-pptx>=1.0.2 -ruamel.yaml>=0.18.16 -sentence-transformers>=5.1.2 -setuptools>=80.9.0 -sse_starlette>=3.0.3 -starlette_context>=0.4.0 -striprtf>=0.0.29 -torch>=2.9.1 -torchvision>=0.24.1 -transformers>=4.57.3 -unstructured @ git+https://github.com/kyteinsky/unstructured@68394f64e8fcf800945327eb246369ab31d95eca -wheel>=0.45.1 +ruamel.yaml>=0.19.1 +sentence-transformers>=6.1.0 +# the CUDA image's torch 2.11 requires setuptools<82 +setuptools>=81.0.0 +sse_starlette>=3.5.0 +starlette_context>=0.5.1 +striprtf>=0.0.33 +# the Docker images drop these two lines and install torch from a per-flavour +# index instead; keep in sync with TORCH_VERSION / TORCHVISION_VERSION there +torch==2.14.1 +torchvision==0.29.1 +transformers>=5.19.0 +unstructured @ git+https://github.com/kyteinsky/unstructured@09ad2f18b0048b90a25de6439d49753bd6670090 +wheel>=0.48.0 xlrd>=2.0.2