mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-07-14 08:42:45 +02:00
Merge pull request #468 from icovada/migrate-to-uv
Manage dependencies with `uv`
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
__pycache__/
|
||||||
@@ -32,15 +32,16 @@ jobs:
|
|||||||
token: ${{ secrets.PAT }}
|
token: ${{ secrets.PAT }}
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
- name: Set up Python 3.11
|
- name: Install uv
|
||||||
uses: actions/setup-python@v4
|
uses: astral-sh/setup-uv@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.11'
|
enable-cache: true
|
||||||
|
|
||||||
|
- name: Set up Python 3.11
|
||||||
|
run: uv python install 3.11
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: uv sync --frozen --no-dev
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install -r requirements.txt
|
|
||||||
|
|
||||||
- name: Install gettext
|
- name: Install gettext
|
||||||
run: sudo apt-get install -y gettext
|
run: sudo apt-get install -y gettext
|
||||||
@@ -48,7 +49,7 @@ jobs:
|
|||||||
- name: Run makemessages
|
- name: Run makemessages
|
||||||
run: |
|
run: |
|
||||||
cd app
|
cd app
|
||||||
python manage.py makemessages -a
|
uv run python manage.py makemessages -a
|
||||||
|
|
||||||
- name: Check for changes
|
- name: Check for changes
|
||||||
id: check_changes
|
id: check_changes
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ volumes:
|
|||||||
wygiwyh_dev_postgres_data: {}
|
wygiwyh_dev_postgres_data: {}
|
||||||
wygiwyh_temp:
|
wygiwyh_temp:
|
||||||
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -1,14 +1,4 @@
|
|||||||
FROM python:3.11-slim-bookworm AS python-build-stage
|
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
|
||||||
build-essential \
|
|
||||||
libpq-dev \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY ../requirements.txt .
|
|
||||||
RUN pip wheel --wheel-dir /usr/src/app/wheels -r requirements.txt
|
|
||||||
|
|
||||||
FROM python:3.11-slim-bookworm AS python-run-stage
|
|
||||||
|
|
||||||
ARG VERSION=dev
|
ARG VERSION=dev
|
||||||
ENV APP_VERSION=$VERSION
|
ENV APP_VERSION=$VERSION
|
||||||
@@ -16,16 +6,17 @@ ENV APP_VERSION=$VERSION
|
|||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1 \
|
||||||
|
UV_COMPILE_BYTECODE=1 \
|
||||||
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
|
UV_LINK_MODE=copy \
|
||||||
|
UV_PROJECT_ENVIRONMENT=/opt/venv
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install --no-install-recommends -y gettext supervisor && \
|
apt-get install --no-install-recommends -y gettext supervisor && \
|
||||||
rm -rf /var/lib/apt/lists/* && \
|
rm -rf /var/lib/apt/lists/*
|
||||||
pip install --upgrade pip && \
|
|
||||||
pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* && \
|
COPY pyproject.toml uv.lock ./
|
||||||
rm -rf /wheels/ ~/.cache/pip/*
|
RUN uv sync --frozen --no-install-project --no-dev
|
||||||
|
|
||||||
COPY ./docker/dev/django/start /start
|
COPY ./docker/dev/django/start /start
|
||||||
COPY ./docker/dev/procrastinate/start /start-procrastinate
|
COPY ./docker/dev/procrastinate/start /start-procrastinate
|
||||||
@@ -40,6 +31,8 @@ RUN sed -i 's/\r$//g' /start && \
|
|||||||
sed -i 's/\r$//g' /start-supervisor && \
|
sed -i 's/\r$//g' /start-supervisor && \
|
||||||
chmod +x /start-supervisor
|
chmod +x /start-supervisor
|
||||||
|
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
COPY ./app .
|
COPY ./app .
|
||||||
|
|
||||||
CMD ["/start-supervisor"]
|
CMD ["/start-supervisor"]
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
FROM python:3.11-slim-bookworm AS python-build-stage
|
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS python-build-stage
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV UV_COMPILE_BYTECODE=1 \
|
||||||
|
UV_LINK_MODE=copy
|
||||||
|
|
||||||
RUN apt-get update && apt-get install --no-install-recommends -y \
|
RUN apt-get update && apt-get install --no-install-recommends -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
libpq-dev \
|
libpq-dev \
|
||||||
curl \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install uv for faster package resolution
|
COPY uv.lock pyproject.toml ./
|
||||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
||||||
|
|
||||||
COPY ./requirements.txt .
|
|
||||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
uv pip install --system --compile-bytecode -r requirements.txt
|
uv sync --frozen --no-install-project --no-dev
|
||||||
|
|
||||||
FROM node:lts-alpine AS vite_build
|
FROM node:lts-alpine AS vite_build
|
||||||
WORKDIR /usr/src/frontend
|
WORKDIR /usr/src/frontend
|
||||||
@@ -33,9 +35,8 @@ ENV APP_VERSION=$VERSION
|
|||||||
|
|
||||||
COPY --from=vite_build /usr/src/frontend/build /usr/src/frontend/build
|
COPY --from=vite_build /usr/src/frontend/build /usr/src/frontend/build
|
||||||
|
|
||||||
# Copy Python packages from build stage
|
# Copy virtual environment from build stage
|
||||||
COPY --from=python-build-stage /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
|
COPY --from=python-build-stage /app/.venv /app/.venv
|
||||||
COPY --from=python-build-stage /usr/local/bin /usr/local/bin
|
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
@@ -43,7 +44,8 @@ RUN addgroup --system app && \
|
|||||||
adduser --system --ingroup app app
|
adduser --system --ingroup app app
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PYTHONUNBUFFERED=1
|
PYTHONUNBUFFERED=1 \
|
||||||
|
PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
# Install runtime dependencies
|
# Install runtime dependencies
|
||||||
RUN --mount=type=cache,target=/root/.cache/apt \
|
RUN --mount=type=cache,target=/root/.cache/apt \
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
[project]
|
||||||
|
name = "wygiwyh"
|
||||||
|
dynamic = ["version"]
|
||||||
|
description = "An opinionated and powerful finance tracker."
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.11"
|
||||||
|
dependencies = [
|
||||||
|
"crispy-bootstrap5==2025.6",
|
||||||
|
"django~=5.2.9",
|
||||||
|
"django-allauth[socialaccount]~=65.13.1",
|
||||||
|
"django-browser-reload==1.21.0",
|
||||||
|
"django-cachalot~=2.8.0",
|
||||||
|
"django-cotton<2.3.0",
|
||||||
|
"django-crispy-forms==2.5",
|
||||||
|
"django-debug-toolbar==6.1.0",
|
||||||
|
"django-filter==25.2",
|
||||||
|
"django-hijack==3.7.4",
|
||||||
|
"django-import-export~=4.3.9",
|
||||||
|
"django-pwa~=2.0.1",
|
||||||
|
"django-vite==3.1.0",
|
||||||
|
"djangorestframework~=3.16.0",
|
||||||
|
"drf-spectacular~=0.29.0",
|
||||||
|
"gunicorn==23.0.0",
|
||||||
|
"mistune~=3.1.3",
|
||||||
|
"openpyxl~=3.1.5",
|
||||||
|
"procrastinate[django]~=3.5.3",
|
||||||
|
"psycopg[binary,pool]==3.2.9",
|
||||||
|
"pydantic~=2.12.3",
|
||||||
|
"python-dateutil~=2.9.0.post0",
|
||||||
|
"pytz>=2025.2",
|
||||||
|
"pyyaml~=6.0.2",
|
||||||
|
"requests~=2.32.5",
|
||||||
|
"simpleeval~=1.0.3",
|
||||||
|
"watchfiles==1.1.1",
|
||||||
|
"whitenoise[brotli]==6.11.0",
|
||||||
|
"xlrd~=2.0.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[tool.setuptools]
|
||||||
|
packages = ["app"]
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
Django~=5.2.9
|
|
||||||
psycopg[binary,pool]==3.2.9
|
|
||||||
django-vite==3.1.0
|
|
||||||
django-crispy-forms==2.5
|
|
||||||
crispy-bootstrap5==2025.6
|
|
||||||
django-browser-reload==1.21.0
|
|
||||||
django-hijack==3.7.4
|
|
||||||
django-filter==25.2
|
|
||||||
django-debug-toolbar==6.1.0
|
|
||||||
django-cachalot~=2.8.0
|
|
||||||
django-cotton<2.3.0
|
|
||||||
django-pwa~=2.0.1
|
|
||||||
djangorestframework~=3.16.0
|
|
||||||
drf-spectacular~=0.29.0
|
|
||||||
django-import-export~=4.3.9
|
|
||||||
|
|
||||||
gunicorn==23.0.0
|
|
||||||
whitenoise[brotli]==6.11.0
|
|
||||||
|
|
||||||
watchfiles==1.1.1
|
|
||||||
procrastinate[django]~=3.5.3
|
|
||||||
|
|
||||||
requests~=2.32.5
|
|
||||||
django-allauth[socialaccount]~=65.13.1
|
|
||||||
|
|
||||||
pytz
|
|
||||||
python-dateutil~=2.9.0.post0
|
|
||||||
simpleeval~=1.0.3
|
|
||||||
pydantic~=2.12.3
|
|
||||||
PyYAML~=6.0.2
|
|
||||||
mistune~=3.1.3
|
|
||||||
openpyxl~=3.1.5
|
|
||||||
xlrd~=2.0.1
|
|
||||||
Reference in New Issue
Block a user