Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Bump and unify PDM in the api/ and indexer_worker/ to 2.21 (#5250)

Krystle Salazar81f0edbdc845
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index 000aa6f81..59212efa2 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -192,6 +192,7 @@ jobs:
build-contexts: ${{ matrix.build-contexts }}
build-args: |
SEMANTIC_VERSION=${{ needs.get-image-tag.outputs.image_tag }}
+ OV_PDM_VERSION=${{ steps.prepare-build-args.outputs.ov_pdm_version }}
CATALOG_PY_VERSION=${{ steps.prepare-build-args.outputs.catalog_py_version }}
CATALOG_AIRFLOW_VERSION=${{ steps.prepare-build-args.outputs.catalog_airflow_version }}
INDEXER_WORKER_PY_VERSION=${{ steps.prepare-build-args.outputs.indexer_worker_py_version }}
@@ -367,6 +368,7 @@ jobs:
cache-to: type=gha,scope=indexer_worker_dev
build-args: |
INDEXER_WORKER_PY_VERSION=${{ steps.prepare-build-args.outputs.indexer_worker_py_version }}
+ OV_PDM_VERSION=${{ steps.prepare-build-args.outputs.ov_pdm_version }}
PDM_INSTALL_ARGS=--dev
- name: Run tests
@@ -484,6 +486,7 @@ jobs:
build-args: |
SEMANTIC_VERSION=${{ needs.get-image-tag.outputs.image_tag }}
API_PY_VERSION=${{ steps.prepare-build-args.outputs.api_py_version }}
+ OV_PDM_VERSION=${{ steps.prepare-build-args.outputs.ov_pdm_version }}
PDM_INSTALL_ARGS=--dev
- name: Start Catalog
diff --git a/api/Dockerfile b/api/Dockerfile
index 54be3f5cf..2f7123d3e 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -10,6 +10,9 @@ ARG API_PY_VERSION
FROM docker.io/python:${API_PY_VERSION} AS builder
+# Get the version from the main justfile
+ARG OV_PDM_VERSION
+
# Container optimizations
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
@@ -19,11 +22,11 @@ ENV PIP_NO_COLOR=1
# - Create a virtualenv inside `/venv`
# - Install PDM to install Python dependencies
RUN apt-get update \
- && apt-get install -yqq --no-install-recommends \
- python3-dev \
+ && apt-get install -yqq --no-install-recommends python3-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
- && pip install pdm~=2.19
+ && pip install --upgrade pip \
+ && pip install pdm~=$OV_PDM_VERSION
# Copy subpackages from additional build-context 'packages'
# hadolint ignore=DL3022
@@ -33,7 +36,7 @@ COPY --from=packages openverse-attribution /packages/python/openverse-attributio
COPY pyproject.toml pdm.lock /
# Pass additional arguments when installing Python packages with PDM
-ARG PDM_INSTALL_ARGS='--no-editable'
+ARG PDM_INSTALL_ARGS="--no-editable"
# Install Python dependencies into a new virtualenv
RUN pdm install --check --frozen-lockfile $PDM_INSTALL_ARGS
diff --git a/api/compose.yml b/api/compose.yml
index f88eee729..9ff821b3a 100644
--- a/api/compose.yml
+++ b/api/compose.yml
@@ -16,6 +16,7 @@ services:
args: # Automatically inferred from env vars, unless specified
- SEMANTIC_VERSION=${SEMANTIC_VERSION:-v1.0.0}
- API_PY_VERSION
+ - OV_PDM_VERSION=${OV_PDM_VERSION}
- PDM_INSTALL_ARGS=--dev
image: openverse-api:${API_PDM_HASH:-latest}
pull_policy: never
diff --git a/api/pdm.lock b/api/pdm.lock
index 5b356af53..c3c05794b 100644
--- a/api/pdm.lock
+++ b/api/pdm.lock
@@ -5,7 +5,7 @@
groups = ["default", "dev", "overrides", "test"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
-content_hash = "sha256:f3221f00e34af7caec4730447e3d2237e735ae558a0ca320f55fadf30a7cc831"
+content_hash = "sha256:86e04ec218fb1f4ffe4e553a2ac20a19c41dd8bc8b3f25d3f19e9319cbf3cea5"
[[metadata.targets]]
requires_python = "==3.12.*"
diff --git a/api/pyproject.toml b/api/pyproject.toml
index dccfef9fe..959658c52 100644
--- a/api/pyproject.toml
+++ b/api/pyproject.toml
@@ -50,9 +50,9 @@ overrides = [
]
dev = [
"debugpy >= 1.8.9, <2",
- "ipython >=8.30.0, <9",
+ "ipython >=8.30, <9",
"pgcli >=4.1, <5",
- "remote-pdb >=2.1.0, <3",
+ "remote-pdb >=2.1, <3",
"setuptools >=75.6, <76",
# FIXME: Should be removed when Python build issues are resolved,
# FIXME: since we don't explicitly use this library.
diff --git a/indexer_worker/Dockerfile b/indexer_worker/Dockerfile
index 95eefba0f..9210ac1f0 100644
--- a/indexer_worker/Dockerfile
+++ b/indexer_worker/Dockerfile
@@ -10,6 +10,9 @@ ARG INDEXER_WORKER_PY_VERSION
FROM docker.io/python:${INDEXER_WORKER_PY_VERSION} AS builder
+# Get the version from the main justfile
+ARG OV_PDM_VERSION
+
# Container optimizations
ENV PYTHONUNBUFFERED=1
ENV PIP_NO_CACHE_DIR=1
@@ -18,17 +21,17 @@ ENV PIP_NO_COLOR=1
# - Install system packages needed for building Python dependencies
# - Install PDM to install Python dependencies
RUN apt-get update \
- && apt-get install -yqq --no-install-recommends \
- python3-dev \
+ && apt-get install -yqq --no-install-recommends python3-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
- && pip install pdm~=2.14
+ && pip install --upgrade pip \
+ && pip install pdm~=$OV_PDM_VERSION
# Copy the Pipenv files into the container
COPY pyproject.toml pdm.lock /
# Pass additional arguments when installing Python packages with PDM
-ARG PDM_INSTALL_ARGS='--no-editable'
+ARG PDM_INSTALL_ARGS="--no-editable"
# Install Python dependencies into a new virtualenv
RUN pdm install --check --frozen-lockfile $PDM_INSTALL_ARGS
diff --git a/indexer_worker/compose.yml b/indexer_worker/compose.yml
index 42e94142d..dffa261ff 100644
--- a/indexer_worker/compose.yml
+++ b/indexer_worker/compose.yml
@@ -8,6 +8,7 @@ services:
target: indexer_worker
args: # Automatically inferred from env vars, unless specified
- INDEXER_WORKER_PY_VERSION
+ - OV_PDM_VERSION=${OV_PDM_VERSION}
- PDM_INSTALL_ARGS=--dev
ports:
- "50282:8003"
diff --git a/justfile b/justfile
index a1b432764..4676d7bbe 100644
--- a/justfile
+++ b/justfile
@@ -232,6 +232,7 @@ env:
DOCKER_FILE := "-f docker-compose.yml"
EXEC_DEFAULTS := if IS_CI == "" { "" } else { "-T" }
+export OV_PDM_VERSION := env_var_or_default("OV_PDM_VERSION", "2.21")
export CATALOG_PY_VERSION := `just catalog/py-version`
export CATALOG_AIRFLOW_VERSION := `just catalog/airflow-version`
export INDEXER_WORKER_PY_VERSION := `just indexer_worker/py-version`
@@ -247,6 +248,7 @@ export HOST_NETWORK_ADDRESS := if os() == "macos" { "host.docker.internal" } els
versions:
#!/usr/bin/env bash
cat <<EOF
+ ov_pdm_version=$(echo $OV_PDM_VERSION)
catalog_py_version=$(just catalog/py-version)
catalog_airflow_version=$(just catalog/airflow-version)
api_py_version=$(just api/py-version)