Skip to content

Commit 5cec0f3

Browse files
authored
Use uv instead of pip for python packages (#2129)
1 parent 921b8fd commit 5cec0f3

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

dev/docker-compose.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,22 @@ services:
188188

189189
# Provision service - creates test data via Spark
190190
provision:
191-
image: python:3.12-slim
191+
image: ghcr.io/astral-sh/uv:python3.12-bookworm-slim
192192
networks:
193193
iceberg_test:
194194
depends_on:
195195
spark-iceberg:
196196
condition: service_healthy
197-
entrypoint: ["/bin/sh", "-c", "pip install -q 'pyspark[connect]==4.0.1' && python3 /opt/spark/provision.py && touch /tmp/provision_complete && tail -f /dev/null"]
197+
entrypoint: ["/bin/sh", "-c", "uv run /opt/spark/provision.py && touch /tmp/provision_complete && tail -f /dev/null"]
198198
volumes:
199199
- ./spark/provision.py:/opt/spark/provision.py:ro
200+
- uv-cache:/root/.cache/uv
200201
healthcheck:
201202
test: ["CMD-SHELL", "[ -f /tmp/provision_complete ]"]
202203
interval: 2s
203204
timeout: 2s
204205
retries: 90
205206
start_period: 20s
207+
208+
volumes:
209+
uv-cache:

dev/spark/provision.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
# /// script
19+
# requires-python = ">=3.12"
20+
# dependencies = [
21+
# "pyspark[connect]==4.0.1",
22+
# ]
23+
# ///
24+
1825
from pyspark.sql import SparkSession
1926
from pyspark.sql.functions import current_date, date_add, expr
2027

0 commit comments

Comments
 (0)