mirror of
https://github.com/eitchtee/WYGIWYH.git
synced 2026-04-19 07:19:53 +02:00
Merge pull request #468 from icovada/migrate-to-uv
Manage dependencies with `uv`
This commit is contained in:
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
__pycache__/
|
||||
15
.github/workflows/translations.yml
vendored
15
.github/workflows/translations.yml
vendored
@@ -32,15 +32,16 @@ jobs:
|
||||
token: ${{ secrets.PAT }}
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v4
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
enable-cache: true
|
||||
|
||||
- name: Set up Python 3.11
|
||||
run: uv python install 3.11
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt
|
||||
run: uv sync --frozen --no-dev
|
||||
|
||||
- name: Install gettext
|
||||
run: sudo apt-get install -y gettext
|
||||
@@ -48,7 +49,7 @@ jobs:
|
||||
- name: Run makemessages
|
||||
run: |
|
||||
cd app
|
||||
python manage.py makemessages -a
|
||||
uv run python manage.py makemessages -a
|
||||
|
||||
- name: Check for changes
|
||||
id: check_changes
|
||||
|
||||
@@ -2,6 +2,7 @@ volumes:
|
||||
wygiwyh_dev_postgres_data: {}
|
||||
wygiwyh_temp:
|
||||
|
||||
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
|
||||
@@ -1,14 +1,4 @@
|
||||
FROM python:3.11-slim-bookworm AS python-build-stage
|
||||
|
||||
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
|
||||
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim
|
||||
|
||||
ARG VERSION=dev
|
||||
ENV APP_VERSION=$VERSION
|
||||
@@ -16,16 +6,17 @@ ENV APP_VERSION=$VERSION
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
COPY --from=python-build-stage /usr/src/app/wheels /wheels/
|
||||
PYTHONUNBUFFERED=1 \
|
||||
UV_COMPILE_BYTECODE=1 \
|
||||
UV_LINK_MODE=copy \
|
||||
UV_PROJECT_ENVIRONMENT=/opt/venv
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install --no-install-recommends -y gettext supervisor && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
pip install --upgrade pip && \
|
||||
pip install --no-cache-dir --no-index --find-links=/wheels/ /wheels/* && \
|
||||
rm -rf /wheels/ ~/.cache/pip/*
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY pyproject.toml uv.lock ./
|
||||
RUN uv sync --frozen --no-install-project --no-dev
|
||||
|
||||
COPY ./docker/dev/django/start /start
|
||||
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 && \
|
||||
chmod +x /start-supervisor
|
||||
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
COPY ./app .
|
||||
|
||||
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 \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install uv for faster package resolution
|
||||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
||||
COPY uv.lock pyproject.toml ./
|
||||
|
||||
COPY ./requirements.txt .
|
||||
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
|
||||
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 Python packages 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 /usr/local/bin /usr/local/bin
|
||||
# Copy virtual environment from build stage
|
||||
COPY --from=python-build-stage /app/.venv /app/.venv
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
@@ -43,7 +44,8 @@ RUN addgroup --system app && \
|
||||
adduser --system --ingroup app app
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN --mount=type=cache,target=/root/.cache/apt \
|
||||
|
||||
40
pyproject.toml
Normal file
40
pyproject.toml
Normal file
@@ -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