From 950bcf516c9cd3ff71c99ceeff02b861ca04613b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Schr=C3=B6der?= Date: Thu, 28 May 2026 09:27:36 +0200 Subject: [PATCH] Tool als pip-Paket. --- README.md | 28 +++++++++++++--------- gitea_classroom/__init__.py | 1 + classroom.py => gitea_classroom/main.py | 31 ++++++++----------------- pyproject.toml | 21 +++++++++++++++++ 4 files changed, 49 insertions(+), 32 deletions(-) create mode 100644 gitea_classroom/__init__.py rename classroom.py => gitea_classroom/main.py (96%) create mode 100644 pyproject.toml diff --git a/README.md b/README.md index 905856f..6f8f6fa 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,20 @@ GitHub Classroom Ersatz für selbst-gehostete Gitea-Instanzen. Unterstützt **Einzel-Assignments** (ein Repo pro Student) und **Gruppen-Assignments** (ein Repo pro Gruppe mit eigenem Gitea-Team). -**Hinweis:** Dieses Tool wurde durch KI erstellt. +**Hinweis:** Dieses Tool wurde mit KI erstellt. ## Installation ```bash -python -m venv venv -source venv/bin/activate -pip install -r requirements.txt +pip install gitea-classroom +``` + +Oder lokal aus dem Quellcode: + +```bash +git clone https://github.com/…/gitea-classroom +cd gitea-classroom +pip install -e . ``` ## Konfiguration @@ -61,7 +67,7 @@ Gruppenname (`group`) wird Teil des Repo-Namens: `proj01-team-a` ### `add-students` — Studenten zur Organisation hinzufügen ```bash -python classroom.py add-students --org info2-ss25 --csv students.csv +gitea-classroom add-students --org info2-ss25 --csv students.csv ``` Fügt alle Nutzer aus der CSV dem `students`-Team der Org hinzu. @@ -72,7 +78,7 @@ Die Gitea-Accounts müssen vorher existieren. ### `create-assignment` — Einzel-Assignment erstellen ```bash -python classroom.py create-assignment \ +gitea-classroom create-assignment \ --org info2-ss25 \ --assignment ueb01 \ --template uebung01-template \ @@ -105,7 +111,7 @@ info2-ss25/ ### `create-group-assignment` — Gruppen-Assignment erstellen ```bash -python classroom.py create-group-assignment \ +gitea-classroom create-group-assignment \ --org info2-ss25 \ --assignment proj01 \ --template projekt-template \ @@ -138,7 +144,7 @@ info2-ss25/ ### `list-submissions` — Abgaben einsehen (Übersicht) ```bash -python classroom.py list-submissions --org info2-ss25 --assignment ueb01 +gitea-classroom list-submissions --org info2-ss25 --assignment ueb01 ``` Zeigt den letzten Commit je Repo in einer kompakten Tabelle. @@ -149,7 +155,7 @@ Funktioniert für Einzel- und Gruppen-Assignments. ### `list-group-submissions` — Abgaben einsehen (Detailansicht) ```bash -python classroom.py list-group-submissions --org info2-ss25 --assignment proj01 +gitea-classroom list-group-submissions --org info2-ss25 --assignment proj01 ``` Zeigt die letzten 5 Commits je Gruppen-Repo. @@ -159,7 +165,7 @@ Zeigt die letzten 5 Commits je Gruppen-Repo. ### `clone-submissions` — Abgaben lokal klonen ```bash -python classroom.py clone-submissions \ +gitea-classroom clone-submissions \ --org info2-ss25 \ --assignment ueb01 \ --dir ./abgaben @@ -179,7 +185,7 @@ Bei erneutem Aufruf wird `git pull` auf bereits geklonte Repos ausgeführt. ### `delete-assignment` — Assignment löschen ```bash -python classroom.py delete-assignment --org info2-ss25 --assignment ueb01 +gitea-classroom delete-assignment --org info2-ss25 --assignment ueb01 ``` Löscht alle Repos und die zugehörigen Gruppen-Teams des Assignments. diff --git a/gitea_classroom/__init__.py b/gitea_classroom/__init__.py new file mode 100644 index 0000000..3dc1f76 --- /dev/null +++ b/gitea_classroom/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/classroom.py b/gitea_classroom/main.py similarity index 96% rename from classroom.py rename to gitea_classroom/main.py index 4aeae8b..2b68c2a 100644 --- a/classroom.py +++ b/gitea_classroom/main.py @@ -2,29 +2,18 @@ """ gitea-classroom — GitHub Classroom Ersatz für Gitea ==================================================== -Voraussetzungen: - pip install py-gitea requests - Konfiguration: - Umgebungsvariablen setzen oder Werte unten direkt eintragen. + export GITEA_URL="https://gitea.meine-uni.de" + export GITEA_TOKEN="dein_api_token" -Befehle (Einzel-Assignments): - python classroom.py add-students --org MeinKurs --csv students.csv - python classroom.py create-assignment --org MeinKurs --assignment ueb01 --template uebung01-template --csv students.csv - python classroom.py list-submissions --org MeinKurs --assignment ueb01 - python classroom.py delete-assignment --org MeinKurs --assignment ueb01 - -Befehle (Gruppen-Assignments): - python classroom.py create-group-assignment --org MeinKurs --assignment proj01 --template projekt-template --csv groups.csv - python classroom.py list-group-submissions --org MeinKurs --assignment proj01 - python classroom.py delete-assignment --org MeinKurs --assignment proj01 # (gleicher Befehl) - -Gruppen-CSV Format (groups.csv): - group,username - team-a,max.mustermann - team-a,erika.musterfrau - team-b,lena.schmidt - team-b,tom.mueller +Befehle: + gitea-classroom add-students --org MeinKurs --csv students.csv + gitea-classroom create-assignment --org MeinKurs --assignment ueb01 --template uebung01-template --csv students.csv + gitea-classroom create-group-assignment --org MeinKurs --assignment proj01 --template proj-template --csv groups.csv + gitea-classroom list-submissions --org MeinKurs --assignment ueb01 + gitea-classroom list-group-submissions --org MeinKurs --assignment proj01 + gitea-classroom clone-submissions --org MeinKurs --assignment ueb01 --dir ./abgaben + gitea-classroom delete-assignment --org MeinKurs --assignment ueb01 """ import argparse diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..937f2cc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["setuptools>=68", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "gitea-classroom" +version = "0.1.0" +description = "GitHub Classroom replacement for self-hosted Gitea instances" +readme = "README.md" +license = { file = "LICENSE" } +requires-python = ">=3.10" +dependencies = [ + "py-gitea", + "requests>=2.28", +] + +[project.scripts] +gitea-classroom = "gitea_classroom.main:main" + +[tool.setuptools.packages.find] +include = ["gitea_classroom*"]