Skip to content

Commit 360104c

Browse files
authored
Merge pull request #14 from fairdataihub/dependency-lock
chore: 📌 add pinned dependency lockfile
2 parents 9dd0f14 + 3cd6023 commit 360104c

3 files changed

Lines changed: 139 additions & 21 deletions

File tree

Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,15 @@ RUN ln -sf /usr/bin/python3.10 /usr/bin/python
3333
# Set working directory
3434
WORKDIR /app
3535

36-
# Copy requirements and install Python dependencies
36+
# Install the exact, pinned dependency set for reproducible builds.
37+
# Regenerate requirements-lock.txt from the running container when bumping deps.
3738
# IMPORTANT: rebuild with `docker build --no-cache` when poster2json has a new release
38-
COPY requirements-prod.txt requirements.txt
39+
COPY requirements-lock.txt .
3940
RUN pip3 install --upgrade pip && \
40-
pip3 install --no-cache-dir -r requirements.txt
41+
pip3 install --no-cache-dir -r requirements-lock.txt
4142

43+
# Layer the newest poster2json on top of the pinned base (kept intentionally latest).
44+
# pip's default only-if-needed strategy leaves the rest of the stack at locked versions.
4245
RUN pip3 install --no-cache-dir --upgrade poster2json
4346

4447
# Copy application code (poster extraction logic comes from poster2json library)

requirements-lock.txt

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Pinned dependency snapshot — ALL direct and transitive dependencies.
2+
#
3+
# Source of truth: `pip freeze` from the known-good production container
4+
# (poster-extraction image built 2026-07-26, Python 3.10.12), captured after a
5+
# real extraction job completed successfully. Every package below is pinned to
6+
# an exact version so builds are reproducible.
7+
#
8+
# Why this exists:
9+
# requirements-prod.txt uses open ranges (>=) and the Dockerfile installs the
10+
# latest poster2json, so every `--no-cache` build could resolve a different
11+
# dependency tree. That is exactly what caused the July outage: an unpinned
12+
# rebuild pulled a newer bitsandbytes/transformers that routes the quantized
13+
# model through Triton, which JIT-compiles a cuda_utils helper and needs
14+
# Python.h — a header the image was silently missing. This lockfile removes
15+
# that class of surprise by freezing the whole tree to a verified-good set.
16+
#
17+
# To regenerate after an intentional dependency bump (from the running container):
18+
# docker exec poster-extraction pip3 freeze | sort -f > requirements-lock.txt
19+
#
20+
# The Dockerfile installs the runtime environment from this file; the newest
21+
# poster2json is then layered on top (kept intentionally latest).
22+
23+
absl-py==2.5.0
24+
accelerate==1.14.0
25+
annotated-doc==0.0.4
26+
anyio==4.14.2
27+
art==6.5
28+
attrs==26.1.0
29+
av==17.1.0
30+
bitsandbytes==0.50.0
31+
blinker==1.9.0
32+
certifi==2026.7.22
33+
cffi==2.1.0
34+
charset-normalizer==3.4.9
35+
click==8.4.2
36+
cryptography==49.0.0
37+
cuda-bindings==13.3.1
38+
cuda-pathfinder==1.6.0
39+
cuda-toolkit==13.0.3.0
40+
defusedxml==0.7.1
41+
exceptiongroup==1.3.1
42+
filelock==3.32.0
43+
Flask==3.1.3
44+
flask-cors==6.0.5
45+
fsspec==2026.6.0
46+
h11==0.16.0
47+
hf-xet==1.5.2
48+
httpcore==1.0.9
49+
httpx==0.28.1
50+
huggingface_hub==1.24.0
51+
idna==3.18
52+
itsdangerous==2.2.0
53+
Jinja2==3.1.6
54+
joblib==1.5.3
55+
json_repair==0.61.7
56+
jsonschema==4.26.0
57+
jsonschema-specifications==2025.9.1
58+
lingua-language-detector==2.1.1
59+
markdown-it-py==4.2.0
60+
MarkupSafe==3.0.3
61+
mdurl==0.1.2
62+
mpmath==1.3.0
63+
networkx==3.4.2
64+
nltk==3.10.0
65+
numpy==2.2.6
66+
nvidia-cublas==13.1.1.3
67+
nvidia-cuda-cupti==13.0.85
68+
nvidia-cuda-nvrtc==13.0.88
69+
nvidia-cuda-runtime==13.0.96
70+
nvidia-cudnn-cu13==9.20.0.48
71+
nvidia-cufft==12.0.0.61
72+
nvidia-cufile==1.15.1.6
73+
nvidia-curand==10.4.0.35
74+
nvidia-cusolver==12.0.4.66
75+
nvidia-cusparse==12.6.3.3
76+
nvidia-cusparselt-cu13==0.8.1
77+
nvidia-nccl-cu13==2.29.7
78+
nvidia-nvjitlink==13.3.33
79+
nvidia-nvshmem-cu13==3.4.5
80+
nvidia-nvtx==13.0.85
81+
packaging==26.2
82+
pdfminer.six==20260107
83+
pdfplumber==0.11.10
84+
pillow==12.3.0
85+
poster2json==0.9.23
86+
psutil==7.2.2
87+
psycopg2-binary==2.9.12
88+
pycparser==3.0
89+
Pygments==2.20.0
90+
pymupdf==1.28.0
91+
pypdfium2==5.12.1
92+
python-dotenv==1.2.2
93+
PyYAML==6.0.3
94+
qwen-vl-utils==0.0.14
95+
referencing==0.37.0
96+
regex==2026.7.19
97+
requests==2.34.2
98+
rich==15.0.0
99+
rouge_score==0.1.2
100+
rpds-py==0.30.0
101+
safetensors==0.8.0
102+
sentencepiece==0.2.2
103+
shellingham==1.5.4
104+
six==1.17.0
105+
sympy==1.14.0
106+
tokenizers==0.22.2
107+
torch==2.13.0
108+
torchvision==0.28.0
109+
tqdm==4.69.1
110+
transformers==5.14.1
111+
triton==3.7.1
112+
typer==0.27.0
113+
typing_extensions==4.16.0
114+
urllib3==2.7.0
115+
Werkzeug==3.1.8

requirements.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,41 @@
22
poster2json
33

44
# Core dependencies (required by poster2json, included for explicit pinning)
5-
transformers>=4.40.0
6-
torch>=2.0.0
7-
torchvision>=0.15.0
8-
accelerate>=0.20.0
9-
bitsandbytes>=0.41.0
10-
safetensors
11-
sentencepiece
5+
transformers==5.14.1
6+
torch==2.13.0
7+
torchvision==0.28.0
8+
accelerate==1.14.0
9+
bitsandbytes==0.50.0
10+
safetensors==0.8.0
11+
sentencepiece==0.2.2
1212

1313
# Flash Attention 2 for faster inference (optional but recommended)
1414
# Requires CUDA 11.6+ and compatible GPU (Ampere, Ada Lovelace, Hopper)
1515
# Install with: pip install flash-attn --no-build-isolation
1616
flash-attn>=2.5.0; platform_system == "Linux"
1717

1818
# Text processing
19-
rouge-score
20-
numpy
19+
rouge-score==0.1.2
20+
numpy==2.2.6
2121

2222
# Image/PDF processing
23-
Pillow
24-
pymupdf
23+
Pillow==12.3.0
24+
pymupdf==1.28.0
2525

2626
# API
27-
python-dotenv>=1.0.0
28-
flask>=2.3.0
29-
flask-cors>=4.0.0
30-
requests>=2.31.0
31-
jsonschema>=4.20.0
32-
psycopg2-binary>=2.9.0
27+
python-dotenv==1.2.2
28+
flask==3.1.3
29+
flask-cors==6.0.5
30+
requests==2.34.2
31+
jsonschema==4.26.0
32+
psycopg2-binary==2.9.12
3333

3434
# ipynb dependencies (for testing and development)
3535
ipykernel
3636
jupyterlab
3737

3838
# Development (optional)
39-
tqdm
39+
tqdm==4.69.1
4040
# black
4141
# isort
4242
# flake8

0 commit comments

Comments
 (0)