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

Migrate to UV & fix some tests #185

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
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
19 changes: 11 additions & 8 deletions .github/workflows/cdkactions_build-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,30 @@ jobs:
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: v0-${{ hashFiles('backend/Pipfile.lock') }}
key: v0-${{ hashFiles('backend/uv.lock') }}
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.4.30"
- name: Install Dependencies
run: |-
cd backend
pip install pipenv
pipenv install --deploy --dev
uv sync
- name: Lint (flake8)
run: |-
cd backend
pipenv run flake8 .
uv run flake8 .
- name: Lint (black)
run: |-
cd backend
pipenv run black --check .
uv run black --check .
- name: Test (run in parallel)
run: |-
cd backend
pipenv run python -m coverage run --concurrency=multiprocessing manage.py test --settings=Platform.settings.ci --parallel
pipenv run python -m coverage combine
uv run python -m coverage run --concurrency=multiprocessing manage.py test --settings=Platform.settings.ci --parallel
uv run python -m coverage combine
container:
image: python:3.10-buster
image: python:3.11-bookworm
env:
DATABASE_URL: postgres://postgres:postgres@postgres:5432/postgres
services:
Expand Down
21 changes: 18 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,32 @@ RUN apt-get update \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install uv
# Download the latest installer
ADD https://astral.sh/uv/0.6.0/install.sh /uv-installer.sh

RUN echo "5464b06094b6363861b99cd60a010892e52fc2a7503b7594419828e74afecfe6 /uv-installer.sh" | sha256sum -c

# Run the installer then remove it
RUN sh /uv-installer.sh && rm /uv-installer.sh

# Ensure the installed binary is on the `PATH`
ENV PATH="/root/.local/bin/:$PATH"

#RUN curl -LsSf https://astral.sh/uv/0.4.30/install.sh | sh

# Copy config files
COPY docker/shibboleth/ /etc/shibboleth/
COPY docker/nginx-default.conf /etc/nginx/conf.d/default.conf
COPY docker/shib_clear_headers /etc/nginx/
COPY docker/supervisord.conf /etc/supervisor/

# Copy project dependencies
COPY Pipfile* /app/
COPY pyproject.toml /app/
COPY uv.lock /app/

# Install project dependencies
RUN pipenv install --deploy --system
RUN cd /app/ && uv sync

# Copy project files
COPY . /app/
Expand All @@ -38,7 +53,7 @@ ENV IDENTITY_RSA_PRIVATE_KEY 'temporary private key just to build the docker ima
ENV OIDC_RSA_PRIVATE_KEY 'temporary private key just to build the docker image'

# Collect static files
RUN python3 /app/manage.py collectstatic --noinput
RUN uv run /app/manage.py collectstatic --noinput

# Copy mime definitions
COPY docker/mime.types /etc/mime.types
Expand Down
25 changes: 22 additions & 3 deletions backend/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,30 @@ FROM pennlabs/django-base:b269ea1613686b1ac6370154debbb741b012de1a-3.11

LABEL maintainer="Penn Labs"

# Install dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install uv
# Download the latest installer
ADD https://astral.sh/uv/0.6.0/install.sh /uv-installer.sh

RUN echo "5464b06094b6363861b99cd60a010892e52fc2a7503b7594419828e74afecfe6 /uv-installer.sh" | sha256sum -c

# Run the installer then remove it
RUN sh /uv-installer.sh && rm /uv-installer.sh

# Ensure the installed binary is on the `PATH`
ENV PATH="/root/.local/bin/:$PATH"

# Copy project dependencies
COPY Pipfile* /app/
COPY pyproject.toml /app/
COPY uv.lock /app/

# Install project dependencies
RUN pipenv install --system
RUN cd /app/ && uv sync

# Copy project files
COPY . /app/
Expand All @@ -15,4 +34,4 @@ ENV DJANGO_SETTINGS_MODULE Platform.settings.staging
ENV SECRET_KEY 'temporary key just to build the docker image'

# Collect static files
RUN python3 /app/manage.py collectstatic --noinput
RUN uv run /app/manage.py collectstatic --noinput
44 changes: 0 additions & 44 deletions backend/Pipfile

This file was deleted.

Loading
Loading