From 6641bcc069f618b1d7e32567f407280df10ada19 Mon Sep 17 00:00:00 2001 From: klemen1999 Date: Tue, 11 Aug 2026 19:18:23 +0200 Subject: [PATCH 1/2] Add constraints in Dockerfile --- Dockerfile | 10 ++++++---- requirements.txt | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2e251e8..040cf37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,14 +6,16 @@ WORKDIR /app ## Install dependencies (including required libraries) RUN apt-get update && apt-get install -y ffmpeg libsm6 libxext6 build-essential cmake git && rm -rf /var/lib/apt/lists/* -# Copy dependency descriptors -COPY pyproject.toml requirements.txt /app/ +# Copy dependency descriptors and constraints used by both pip resolvers. +COPY pyproject.toml requirements.txt constraints.txt /app/ # Copy the app COPY tools /app/tools -# Install Python dependencies without pip cache -RUN pip install --no-cache-dir . +# Apply the constraint to normal and isolated dependency resolution. +RUN PIP_CONSTRAINT=/app/constraints.txt \ + PIP_BUILD_CONSTRAINT=/app/constraints.txt \ + pip install --no-cache-dir . ## Create non-root user and set ownership of the working directory RUN adduser --disabled-password --gecos "" --no-create-home non-root && \ diff --git a/requirements.txt b/requirements.txt index 6fd34b3..eae2450 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +setuptools<82 # vendored YOLOv6 and YOLOv7 import pkg_resources torch>=2.0.0 #,<2.6.0 torchvision>=0.10.1 Pillow>=7.1.2 From fafcde307edb5cd522fe9ea84cf5c5ca6307b7c9 Mon Sep 17 00:00:00 2001 From: klemen1999 Date: Tue, 11 Aug 2026 19:30:57 +0200 Subject: [PATCH 2/2] coderabbit fixes --- Dockerfile | 5 ++++- constraints.txt | 2 +- requirements.txt | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 040cf37..0af7997 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,13 @@ COPY pyproject.toml requirements.txt constraints.txt /app/ # Copy the app COPY tools /app/tools +# PIP_BUILD_CONSTRAINT is supported by pip 26.2 and newer. +RUN python -m pip install --no-cache-dir --upgrade "pip>=26.2" + # Apply the constraint to normal and isolated dependency resolution. RUN PIP_CONSTRAINT=/app/constraints.txt \ PIP_BUILD_CONSTRAINT=/app/constraints.txt \ - pip install --no-cache-dir . + python -m pip install --no-cache-dir . ## Create non-root user and set ownership of the working directory RUN adduser --disabled-password --gecos "" --no-create-home non-root && \ diff --git a/constraints.txt b/constraints.txt index b722ef6..e636878 100644 --- a/constraints.txt +++ b/constraints.txt @@ -1 +1 @@ -setuptools<82 +setuptools>=78.1.1,<82 diff --git a/requirements.txt b/requirements.txt index eae2450..5a19899 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -setuptools<82 # vendored YOLOv6 and YOLOv7 import pkg_resources +setuptools>=78.1.1,<82 # vendored YOLOv6 and YOLOv7 import pkg_resources torch>=2.0.0 #,<2.6.0 torchvision>=0.10.1 Pillow>=7.1.2