Skip to content

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

Install pdm with its dependencies locked so upstream releases cannot break builds (#5689)

Dhruv Bhanushali7394b12fbd73
diff --git a/.github/actions/setup-env/action.yml b/.github/actions/setup-env/action.yml
index 658b4167a..68ab4745b 100644
--- a/.github/actions/setup-env/action.yml
+++ b/.github/actions/setup-env/action.yml
@@ -41,10 +41,13 @@ runs:
- name: Setup global Python deps
if: inputs.setup_python == 'true'
shell: bash
- # TODO: Try using `pipx` here instead of `pip`.
+ # pdm goes through pipx: `pdm[locked]` pins pdm's dependencies (so a
+ # release of one of them cannot break it), and those pins conflict
+ # with pipenv's requirements when both share one environment.
run: |
pip install -U pip
- pip install pipenv pdm
+ pip install pipenv
+ pipx install "pdm[locked]"
- name: Setup pnpm
if: inputs.setup_nodejs == 'true'
diff --git a/api/Dockerfile b/api/Dockerfile
index f927b582a..15fd57dee 100644
--- a/api/Dockerfile
+++ b/api/Dockerfile
@@ -22,13 +22,14 @@ ENV PIP_NO_COLOR=1
# - Install system packages needed for building Python dependencies
# - Create a virtualenv inside `/venv`
-# - Install PDM to install Python dependencies
+# - Install PDM to install Python dependencies, with its own dependencies locked
+# so a release of one of them (hishel 2.0.0 broke pdm) cannot break the build
RUN apt-get update \
&& apt-get install -yqq --no-install-recommends python3-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --upgrade pip \
- && pip install pdm~=$OV_PDM_VERSION
+ && pip install "pdm[locked]~=$OV_PDM_VERSION"
# Copy subpackages from additional build-context 'packages'
# hadolint ignore=DL3022
diff --git a/indexer_worker/Dockerfile b/indexer_worker/Dockerfile
index 879cd1fc8..7239416e3 100644
--- a/indexer_worker/Dockerfile
+++ b/indexer_worker/Dockerfile
@@ -19,13 +19,14 @@ ENV PIP_NO_CACHE_DIR=1
ENV PIP_NO_COLOR=1
# - Install system packages needed for building Python dependencies
-# - Install PDM to install Python dependencies
+# - Install PDM to install Python dependencies, with its own dependencies locked
+# so a release of one of them (hishel 2.0.0 broke pdm) cannot break the build
RUN apt-get update \
&& apt-get install -yqq --no-install-recommends python3-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --upgrade pip \
- && pip install pdm~=$OV_PDM_VERSION
+ && pip install "pdm[locked]~=$OV_PDM_VERSION"
# Copy the Pipenv files into the container
COPY pyproject.toml pdm.lock /