Skip to content

Commit 69f600a

Browse files
authored
fix(sdk): imports and docker handling (#122)
2 parents bd45a56 + ec3e4d5 commit 69f600a

File tree

23 files changed

+2482
-2044
lines changed

23 files changed

+2482
-2044
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
# 1. Rename this file from '.env.example' to '.env'.
77
# 2. Fill in the required variables for your setup.
88
# 3. DO NOT commit the '.env' file to your version control.
9+
# 4. Run `gcloud-deploy.sh` to deploy to GCP with the following configuration.
910
#
1011
# Uncomment the variable to change it from its default value.
1112
# ==============================================================================
1213

1314
# ==============================================================================
1415
# CONFIDENTIAL SPACE DEPLOY CONFIGURATION
1516
# ==============================================================================
16-
# Run `gcloud-deploy.sh` to deploy to GCP with the following configuration.
1717

1818
GCP__INSTANCE_NAME=flare-ai-kit
1919
GCP__PROJECT=verifiable-ai-hackathon

Dockerfile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Parametric Dockerfile for running scripts with specific extras
22
# Usage:
33
# docker build -t fai-script-pdf --build-arg EXTRAS=pdf --build-arg SCRIPT=ingest_pdf.py .
4-
# docker run --rm -it -v "$PWD/data:/app/scripts/data" fai-script-pdf
4+
#
5+
# docker run --rm -it -v "$PWD/scripts/data:/app/scripts/data" --env-file ".env" fai-script-pdf
56

67
# Build arguments for parametric behavior
78
ARG EXTRAS=""
@@ -20,23 +21,21 @@ ENV UV_COMPILE_BYTECODE=1 \
2021

2122
WORKDIR /app
2223

23-
# Install system dependencies for PDF processing (if needed)
24+
# Install system dependencies for PDF processing
2425
RUN apt-get update && apt-get install -y --no-install-recommends \
2526
tesseract-ocr \
2627
tesseract-ocr-eng \
2728
poppler-utils \
2829
&& rm -rf /var/lib/apt/lists/*
2930

30-
# Copy dependency files first for better caching
31+
# Copy dependency files first
3132
COPY uv.lock pyproject.toml ./
3233

3334
# Install dependencies based on EXTRAS parameter
3435
RUN --mount=type=cache,target=/root/.cache/uv \
3536
if [ -n "$EXTRAS" ]; then \
3637
echo "Installing with extras: $EXTRAS"; \
37-
# Convert comma-separated extras to space-separated for uv
3838
EXTRAS_ARGS=$(echo "$EXTRAS" | sed 's/,/ --extra /g'); \
39-
echo "Installing extras: $EXTRAS_ARGS"; \
4039
uv sync --locked --no-install-project --extra $EXTRAS_ARGS --no-dev --no-editable; \
4140
else \
4241
echo "Installing base dependencies only"; \
@@ -49,9 +48,7 @@ COPY . /app
4948
# Install the project itself
5049
RUN --mount=type=cache,target=/root/.cache/uv \
5150
if [ -n "$EXTRAS" ]; then \
52-
# Convert comma-separated extras to space-separated for uv
5351
EXTRAS_ARGS=$(echo "$EXTRAS" | sed 's/,/ --extra /g'); \
54-
echo "Installing project with extras: $EXTRAS_ARGS"; \
5552
uv sync --locked --extra $EXTRAS_ARGS --no-dev --no-editable; \
5653
else \
5754
uv sync --locked --no-dev --no-editable; \
@@ -67,7 +64,7 @@ FROM python:3.12-slim-bookworm AS runtime
6764
ARG EXTRAS
6865
ARG SCRIPT
6966

70-
# Install runtime system dependencies for PDF processing (if needed)
67+
# Install runtime system dependencies
7168
RUN apt-get update && apt-get install -y --no-install-recommends \
7269
tesseract-ocr \
7370
tesseract-ocr-eng \
@@ -76,7 +73,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
7673

7774
ENV PIP_NO_CACHE_DIR=1 \
7875
UV_PYTHON_DOWNLOADS=0 \
79-
SCRIPT_NAME="$SCRIPT"
76+
SCRIPT_NAME="$SCRIPT" \
77+
PYTHONPATH="/app/scripts:/app:$PYTHONPATH"
8078

8179
# Create non-root user
8280
RUN groupadd -r app && \
@@ -96,4 +94,4 @@ USER app
9694
RUN test -f "/app/scripts/$SCRIPT" || (echo "Error: Script /app/scripts/$SCRIPT not found" && exit 1)
9795

9896
# Default command runs the specified script
99-
CMD ["sh", "-c", "cd /app/scripts && python \"$SCRIPT_NAME\""]
97+
CMD ["sh", "-c", "python \"/app/scripts/$SCRIPT_NAME\""]

pyproject.toml

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ classifiers = [
2323
]
2424
requires-python = ">=3.12"
2525
dependencies = [
26-
"google-genai>=1.8.0",
26+
"google-genai>=1.51.0",
2727
"httpx>=0.28.1",
28-
"pydantic>=2.11.1",
29-
"pydantic-ai>=0.0.46",
30-
"structlog>=25.2.0",
31-
"tenacity>=8.2.3,<9.0.0",
32-
"web3>=7.10.0",
28+
"pydantic>=2.12.4",
29+
"structlog>=25.5.0",
30+
"tenacity>=9.0.0,<10.0.0",
31+
"web3>=7.14.0",
3332
"gitpython>=3.1.45",
34-
"google-adk>=1.9.0",
33+
"google-adk>=1.19.0",
3534
]
3635

3736
[project.urls]
@@ -59,55 +58,49 @@ fassets = [
5958
]
6059
pdf = [
6160
"pillow>=11.3.0",
62-
"pymupdf>=1.26.1",
63-
"pytesseract>=0.3.13"
61+
"pymupdf>=1.26.6",
62+
"pytesseract>=0.3.13",
63+
"reportlab>=4.4.5",
64+
"dulwich>=0.24.10"
6465
]
6566
rag = [
66-
"qdrant-client>=1.13.3",
67-
"dulwich>=0.23.2"
67+
"qdrant-client==1.15.1",
68+
"dulwich>=0.24.10"
6869
]
6970
a2a = [
70-
"fastapi[standard]>=0.116.1",
71+
"fastapi[standard]>=0.118.0",
7172
]
7273
# Additional functionality groups
7374
social = [
74-
"python-telegram-bot>=22.0",
75-
"tweepy>=4.15.0",
75+
"python-telegram-bot>=22.5",
76+
"tweepy>=4.16.0",
7677
"async_lru>=2.0.5",
77-
"slack-sdk>=3.26.2",
78-
"discord.py>=2.3.2"
78+
"slack-sdk>=3.38.0",
79+
"discord.py>=2.6.4"
7980
]
8081
tee = [
81-
"cryptography>=44.0.2",
82+
"cryptography>=46.0.3",
8283
"pyjwt>=2.10.1",
83-
"pyopenssl>=25.0.0"
84+
"pyopenssl>=25.3.0"
8485
]
8586
wallet = [
86-
"httpx>=0.28.1",
87-
"cryptography>=44.0.2",
88-
"eth-account>=0.13.0",
87+
"cryptography>=46.0.3",
88+
"eth-account>=0.13.7",
8989
"pyjwt>=2.10.1",
9090
]
91-
ingestion = [
92-
"pillow>=11.3.0",
93-
"pymupdf>=1.26.1",
94-
"pytesseract>=0.3.13"
95-
]
9691

9792
[build-system]
9893
requires = ["hatchling"]
9994
build-backend = "hatchling.build"
10095

10196
[dependency-groups]
10297
dev = [
103-
"pyright>=1.1.398",
104-
"pytest>=8.3.5",
105-
"pytest-asyncio>=0.26.0",
106-
"pytest-mock>=3.14.0",
107-
"ruff>=0.11.2",
98+
"pyright>=1.1.407",
99+
"pytest>=9.0.1",
100+
"pytest-asyncio>=1.3.0",
101+
"pytest-mock>=3.15.1",
102+
"ruff>=0.14.5",
108103
"settings-doc>=4.3.2",
109-
"reportlab>=4.2.0",
110-
"gitpython>=3.1.45",
111104
]
112105

113106
[tool.ruff]

scripts/data/create_sample_invoice.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ def create_invoice_and_build_template(
146146
c.drawRightString(width - 0.7 * inch, 4.0 * inch, AMOUNT_DUE)
147147

148148
c.save()
149-
print(f"✅ Created {FILE_PATH}")
150149

151150
# ----- Discover coordinates & build template -----
152151
with fitz.open(str(FILE_PATH)) as doc:
@@ -168,7 +167,6 @@ def create_invoice_and_build_template(
168167
}
169168

170169
template = _coords_to_template(template_name, coords)
171-
print(f"✅ Built PDF template: {template.template_name}")
172170
return FILE_PATH, template
173171

174172

0 commit comments

Comments
 (0)