Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions api/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 7 additions & 4 deletions indexer_worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions indexer_worker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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)
Expand Down
Loading