Skip to content

ci: add workflow_dispatch and remove broken re-install step#93

Merged
jancwe merged 1 commit intomainfrom
copilot/remove-pyproject-toml
Mar 22, 2026
Merged

ci: add workflow_dispatch and remove broken re-install step#93
jancwe merged 1 commit intomainfrom
copilot/remove-pyproject-toml

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

After retargeting the PR from the orphaned develop branch to main, the CI was stuck in "expected" state with no way to manually re-trigger it.

Changes

  • workflow_dispatch trigger added — CI can now be triggered manually from the Actions UI, independent of branch events
  • Removed stale "Re-install local package" step — this leftover step ran pip install --force-reinstall --no-deps ".[dev]" on cache hits, which would fail on every cached run now that pyproject.toml is gone
Original prompt

Hintergrund

Das Projekt wurde irgendwann von requirements.txt auf pyproject.toml mit setuptools umgestellt, um dev- und production-Dependencies zusammenzuführen. Das hat das Projekt de facto von einer Python-Anwendung zu einer Python-Bibliothek gemacht. Die Konsequenz: Im Dockerfile muss pip install . verwendet werden, was ein Wheel baut und den gesamten Quellcode in site-packages installiert. Das macht Docker-Layer-Caching unmöglich, weil jede Code-Änderung den pip install-Layer invalidiert und alle Dependencies neu installiert werden.

Ziel

Die pyproject.toml vollständig durch requirements.txt (Produktion) und requirements-dev.txt (Entwicklung/Tests) ersetzen. Das Projekt soll als Python-Anwendung behandelt werden, nicht als Bibliothek.

Konkrete Änderungen

1. pyproject.toml → LÖSCHEN

Die Datei komplett entfernen. Aktueller Inhalt zur Referenz:

[build-system]
requires = ["setuptools>=69"]
build-backend = "setuptools.build_meta"

[project]
name = "formflow"
version = "0.1.0"
description = "Dynamischer Formular- & PDF-Generator"
requires-python = ">=3.11"
dependencies = [
    "Flask==3.1.3",
    "PyYAML==6.0.3",
    "gunicorn==25.1.0",
    "WeasyPrint==68.1",
    "smbprotocol==1.16.0",
    "pydantic==2.12.5",
    "pydantic-settings==2.13.1",
]

[project.optional-dependencies]
dev = [
    "pytest==9.0.2",
    "requests==2.32.5",
    "pytest-mock==3.15.1",
]

[tool.setuptools.packages.find]
where = ["src"]
include = ["formflow*"]

[tool.setuptools.package-data]
formflow = [
    "pdf_templates/*.html",
    "templates/*.html",
    "static/**/*",
]

2. requirements.txt → NEU ERSTELLEN

Produktions-Dependencies (exakt die gleichen Versionen wie bisher in pyproject.toml):

Flask==3.1.3
PyYAML==6.0.3
gunicorn==25.1.0
WeasyPrint==68.1
smbprotocol==1.16.0
pydantic==2.12.5
pydantic-settings==2.13.1

3. requirements-dev.txt → NEU ERSTELLEN

Dev-Dependencies, die die Produktions-Dependencies einschließen:

-r requirements.txt
pytest==9.0.2
requests==2.32.5
pytest-mock==3.15.1

4. Dockerfile → ÜBERARBEITEN

Aktuelles Dockerfile:

FROM python:3.14-slim

LABEL org.opencontainers.image.version="0.1.0"
LABEL org.opencontainers.image.title="formflow"
LABEL org.opencontainers.image.description="Dynamischer Formular- & PDF-Generator"

WORKDIR /app

RUN apt-get update && apt-get install -y \
    libpango-1.0-0 \
    libpangoft2-1.0-0 \
    libjpeg-dev \
    libopenjp2-7-dev \
    libffi-dev \
    curl \
    && rm -rf /var/lib/apt/lists/*

COPY pyproject.toml .
COPY src/ src/
RUN pip install --no-cache-dir .

COPY . .

RUN mkdir -p /app/static && cp -r src/formflow/static/. /app/static/

RUN mkdir -p /data/forms /data/pdf_templates

EXPOSE 5000

CMD ["gunicorn", "-w", "1", "--timeout", "120", "--max-requests", "500", "--max-requests-jitter", "50", "-b", "0.0.0.0:5000", "app:app"]

Neues Dockerfile soll folgende Struktur haben:

  • Layer 1: Systemabhängigkeiten (apt-get) – ändert sich quasi nie
  • Layer 2: COPY requirements.txt . + RUN pip install --no-cache-dir -r requirements.txt – ändert sich nur bei Dependency-Updates
  • Layer 3: COPY src/ src/ + COPY app.py . – Anwendungscode, ändert sich häufig aber nur dieser Layer wird invalidiert
  • ENV PYTHONPATH=/app/src statt pip install . – Python findet das formflow-Paket über PYTHONPATH
  • Statische Dateien: RUN mkdir -p /app/static && cp -r src/formflow/static/. /app/static/
  • /data-Verzeichnisse: RUN mkdir -p /data/forms /data/pdf_templates
  • KEIN COPY . . mehr – nur gezielt kopieren was gebraucht wird (requirements.txt, src/, app.py, forms/)
  • Die forms/ brauchen wir im Image als Fallback (forms/examples enthält Beispiel-YAMLs)
  • Labels, EXPOSE und CMD bleiben gleich

5. .github/workflows/ci.yml → ÜBERARBEITEN

Aktueller CI-Workflow:

name: CI

on:
  push:
    branches:
      - smb-server
      - main
      - develop
  pull_request:
    branches:
      - smb-server
      - main
      - develop
    types: [opened, synchronize, reopened, ready_for_review]

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Set up Python
        id: setup-python
        uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Cache virtual environment
        id: cache-venv
        uses: actions/cache@v4
        with:
          path: .venv
          key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'src/**/*.py') }}
          restore-keys: |
            venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-

      - name: Install dependencies
        if: steps.cache-venv.outputs.cache-hit != 'true'
        run: |
          python -m venv .venv
          .venv/bin/pip install --upgrade pip
          .venv/bin/pip install ".[dev]"

      - ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

📍 Connect Copilot coding agent with [Jira](https://gh.io/cca-jira-docs), [Azure Boards](https://gh.io/cca-azure-boards-docs) or [Linear](https://gh.io/cca-linear-docs) to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI changed the title [WIP] Remove pyproject.toml to revert to requirements files chore: Replace pyproject.toml with requirements.txt for proper Docker layer caching Mar 21, 2026
Copilot AI requested a review from jancwe March 21, 2026 21:26
@jancwe jancwe marked this pull request as ready for review March 21, 2026 21:40
@jancwe jancwe force-pushed the copilot/remove-pyproject-toml branch from fd3bf93 to aaed58b Compare March 22, 2026 04:30
@jancwe jancwe changed the base branch from develop to main March 22, 2026 04:30
Copilot AI changed the title chore: Replace pyproject.toml with requirements.txt for proper Docker layer caching ci: add workflow_dispatch and remove broken re-install step Mar 22, 2026
Copilot AI requested a review from jancwe March 22, 2026 04:39
because tomls are for libraries and have downsides for applications, a
for example but not only because of proper Docker layer caching

Co-authored-by: jancwe <83763512+jancwe@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jancwe/formflow/sessions/26c5eb2f-39d8-4579-8725-c1e649cbe845

ci: add workflow_dispatch trigger and remove leftover re-install step

Co-authored-by: jancwe <83763512+jancwe@users.noreply.github.com>
Agent-Logs-Url: https://github.com/jancwe/formflow/sessions/774e8b60-6ab0-42f9-8f69-8e185f7fd66f
@jancwe jancwe force-pushed the copilot/remove-pyproject-toml branch from a01c19a to 71f7846 Compare March 22, 2026 04:48
@jancwe jancwe merged commit b69a660 into main Mar 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants