commit 06de3aba7017ecb7e66de43f5d35ca8c0493243d Author: Michael Stangl Date: Mon Jul 20 16:28:31 2026 +0200 leeres Projekt mit Umgebung angelegt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0fb3124 --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ +# ---> Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST +*.manifest +*.spec +pip-log.txt +pip-delete-this-directory.txt +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ +*.mo +*.pot +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ +.spyderproject +.spyproject +.ropeproject +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +.pdm.toml +__pypackages__/ +/site-packages +/site +.ipynb_checkpoints +profile_default/ +ipython_config.py + +# Benutzerdefiniert +/data +/work +/log +/results diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7d81aff --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Michael Stangl, on GitHub mistamichael + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..afde950 --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +# sps_skel + +> Kurze Projektbeschreibung hier eintragen. + +## Projektstruktur + + sps_skel/ + bin/ Skripte zur Umgebungsverwaltung + setenv.bat/.sh Umgebungsvariablen setzen + install_py.bat/.sh venv erstellen + pip install + activate_venv.bat/.sh venv aktivieren + get_cmd.bat/.sh Shell mit Umgebung oeffnen + cfg/ Konfigurationsdateien (INI/JSON) + data/ Eingabedaten (nicht im Git) + doc/ Dokumentation + examples/ Beispieldateien + lib/ Python-Quellcode / Bibliothek + log/ Log-Dateien (nicht im Git) + results/ Ergebnisse / Ausgaben (nicht im Git) + tests/ Unit Tests + .gitignore + LICENSE + README.md + requirements.txt + +## Umgebungsvariablen + +| Variable | Beschreibung | +|----------------|---------------------------| +| `PROJECT` | Wurzelverzeichnis | +| `PV_BIN` | Skriptverzeichnis | +| `PV_LIB` | Python-Quellcode | +| `PV_CFG` | Konfigurationsdateien | +| `PV_DATA` | Eingabedaten | +| `PV_LOG` | Log-Dateien | +| `PV_RESULTS` | Ergebnisse | +| `PV_EXAMPLES` | Beispieldateien | +| `PYTHONPATH` | Erweitert um `PV_LIB` | + +## Installation + +### Voraussetzungen + +- Python 3.10 oder hoeher + +### Setup (Windows) + + bin\install_py.bat + +### Setup (Linux / macOS) + + bash bin/install_py.sh + +## Nutzung + +### Umgebung setzen + + bin\setenv.bat # Windows + source bin/setenv.sh # Linux / macOS + +### Shell mit gesetzten Variablen oeffnen + + bin\get_cmd.bat # Windows + source bin/get_cmd.sh # Linux / macOS + +### venv aktivieren + + bin\activate_venv.bat # Windows + source bin/activate_venv.sh # Linux / macOS + +## Lizenz + +MIT License - siehe LICENSE + +## Autor + +Michael Stangl (GitHub: mistamichael) diff --git a/bin/activate_venv.bat b/bin/activate_venv.bat new file mode 100644 index 0000000..cea05f6 --- /dev/null +++ b/bin/activate_venv.bat @@ -0,0 +1,20 @@ +@echo off +REM ================================================================ +REM SPS_SKEL - Python Virtual Environment aktivieren +REM ================================================================ + +call "%~dp0setenv.bat" + +if not exist "%PROJECT%\.venv" ( + echo FEHLER: Virtual environment nicht gefunden. + echo Bitte zuerst bin\install_py.bat ausfuehren. + exit /b 1 +) + +call "%PROJECT%\.venv\Scripts\activate.bat" +echo Virtuelle Umgebung aktiviert. +echo Python-Version: +python --version +echo. +echo Installierte Pakete: +pip list diff --git a/bin/activate_venv.sh b/bin/activate_venv.sh new file mode 100644 index 0000000..71591bd --- /dev/null +++ b/bin/activate_venv.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# ================================================================ +# SPS_SKEL - Python Virtual Environment aktivieren +# ================================================================ +# Dieses Skript muss gesourct werden: source bin/activate_venv.sh +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +if [ ! -d "$PROJECT/.venv" ]; then + echo "FEHLER: Virtual environment nicht gefunden." + echo "Bitte zuerst bin/install_py.sh ausfuehren." + return 1 +fi + +source "$PROJECT/.venv/bin/activate" +echo "Virtuelle Umgebung aktiviert." +echo "Python-Version:" +python --version +echo "" +echo "Installierte Pakete:" +pip list diff --git a/bin/get_cmd.bat b/bin/get_cmd.bat new file mode 100644 index 0000000..a9a1c55 --- /dev/null +++ b/bin/get_cmd.bat @@ -0,0 +1,7 @@ +@echo off +REM ================================================================ +REM SPS_SKEL - Shell mit gesetzten Umgebungsvariablen oeffnen +REM ================================================================ + +call "%~dp0setenv.bat" +start cmd /k "echo SPS_SKEL Umgebung aktiv. && echo PROJECT=%PROJECT%" diff --git a/bin/get_cmd.sh b/bin/get_cmd.sh new file mode 100644 index 0000000..a7a5a6e --- /dev/null +++ b/bin/get_cmd.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +# ================================================================ +# SPS_SKEL - Shell mit gesetzten Umgebungsvariablen oeffnen +# ================================================================ +# Verwendung: source bin/get_cmd.sh +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +exec "$SHELL" diff --git a/bin/install_py.bat b/bin/install_py.bat new file mode 100644 index 0000000..2ca4569 --- /dev/null +++ b/bin/install_py.bat @@ -0,0 +1,20 @@ +@echo off +REM ================================================================ +REM SPS_SKEL - Python Virtual Environment einrichten +REM ================================================================ + +call "%~dp0setenv.bat" + +if not exist "%PROJECT%\.venv" ( + echo Initialisiere Python virtual environment... + py -m venv "%PROJECT%\.venv" --upgrade-deps + echo Erfolgreich. + + call "%PROJECT%\.venv\Scripts\activate.bat" + echo Installiere erforderliche Python Packages... + pip install -r "%PROJECT%\requirements.txt" -q + echo Erfolgreich. + deactivate +) else ( + echo Erforderliche Python Packages bereits installiert! +) diff --git a/bin/install_py.sh b/bin/install_py.sh new file mode 100644 index 0000000..9f64c37 --- /dev/null +++ b/bin/install_py.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +# ================================================================ +# SPS_SKEL - Python Virtual Environment einrichten +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +if [ ! -d "$PROJECT/.venv" ]; then + echo "Initialisiere Python virtual environment..." + python3 -m venv "$PROJECT/.venv" --upgrade-deps + echo "Erfolgreich." + + source "$PROJECT/.venv/bin/activate" + echo "Installiere erforderliche Python Packages..." + pip install -r "$PROJECT/requirements.txt" -q + echo "Erfolgreich." + deactivate +else + echo "Erforderliche Python Packages bereits installiert!" +fi diff --git a/bin/setenv.bat b/bin/setenv.bat new file mode 100644 index 0000000..e0c586d --- /dev/null +++ b/bin/setenv.bat @@ -0,0 +1,63 @@ +@echo off + +REM ================================================================ +REM SPS_SKEL - Umgebungsvariablen Setup +REM ================================================================ + +if defined PV_BIN ( + echo SPS_SKEL Umgebung bereits gesetzt. + goto :show +) + +echo Setting up environment variables for SPS_SKEL ... + +REM Basis-Projektpfad (aktueller Ordner) +set "PROJECT=%~dp0.." +if "%PROJECT:~-6%"=="bin\.." set "PROJECT=%PROJECT:~0,-6%" +if "%PROJECT:~-1%"=="\" set "PROJECT=%PROJECT:~0,-1%" + +REM Pfade fuer verschiedene Komponenten +set "PV_BIN=%PROJECT%\bin" +set "PV_LIB=%PROJECT%\lib" +set "PV_DATA=%PROJECT%\data" +set "PV_CFG=%PROJECT%\cfg" +set "PV_LOG=%PROJECT%\log" +set "PV_TESTS=%PROJECT%\tests" +set "PV_RESULTS=%PROJECT%\results" +set "PV_EXAMPLES=%PROJECT%\examples" + +REM Python-Pfad erweitern (nur wenn noch nicht vorhanden) +echo %PYTHONPATH% | find /i "%PV_LIB%" >nul +if errorlevel 1 ( + set "PYTHONPATH=%PV_LIB%;%PYTHONPATH%" +) + +REM Ordner erstellen falls sie nicht existieren +if not exist "%PV_BIN%" mkdir "%PV_BIN%" +if not exist "%PV_CFG%" mkdir "%PV_CFG%" +if not exist "%PV_LIB%" mkdir "%PV_LIB%" +if not exist "%PV_DATA%" mkdir "%PV_DATA%" +if not exist "%PV_LOG%" mkdir "%PV_LOG%" +if not exist "%PV_RESULTS%" mkdir "%PV_RESULTS%" +if not exist "%PV_EXAMPLES%" mkdir "%PV_EXAMPLES%" + +REM Umgebungsvariablen anzeigen +:show +echo. +echo ================================================================ +echo SPS_SKEL ENVIRONMENT SETUP COMPLETE +echo ================================================================ +echo PROJECT = %PROJECT% +echo PV_BIN = %PV_BIN% +echo PV_CFG = %PV_CFG% +echo PV_LIB = %PV_LIB% +echo PV_DATA = %PV_DATA% +echo PV_RESULTS = %PV_RESULTS% +echo PV_LOG = %PV_LOG% +echo PV_EXAMPLES = %PV_EXAMPLES% +echo PYTHONPATH = %PYTHONPATH% +echo ================================================================ +echo. + +REM Optionally keep window open +if "%1"=="--keep-open" pause diff --git a/bin/setenv.sh b/bin/setenv.sh new file mode 100644 index 0000000..ae889e5 --- /dev/null +++ b/bin/setenv.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# ================================================================ +# SPS_SKEL - Umgebungsvariablen Setup +# ================================================================ +# Dieses Skript muss gesourct werden: source bin/setenv.sh +# ================================================================ + +echo "Setting up environment variables for SPS_SKEL ..." + +# Basis-Projektpfad (uebergeordnetes Verzeichnis von bin/) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +export PROJECT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# Pfade fuer verschiedene Komponenten +export PV_BIN="$PROJECT/bin" +export PV_LIB="$PROJECT/lib" +export PV_DATA="$PROJECT/data" +export PV_CFG="$PROJECT/cfg" +export PV_LOG="$PROJECT/log" +export PV_TESTS="$PROJECT/tests" +export PV_RESULTS="$PROJECT/results" +export PV_EXAMPLES="$PROJECT/examples" + +# Python-Pfad erweitern (nur wenn noch nicht vorhanden) +if [[ ":$PYTHONPATH:" != *":$PV_LIB:"* ]]; then + export PYTHONPATH="$PV_LIB:$PYTHONPATH" +fi + +# Ordner erstellen falls sie nicht existieren +mkdir -p "$PV_BIN" "$PV_CFG" "$PV_LIB" "$PV_DATA" "$PV_LOG" "$PV_RESULTS" "$PV_EXAMPLES" + +echo "" +echo "================================================================" +echo "SPS_SKEL ENVIRONMENT SETUP COMPLETE" +echo "================================================================" +echo "PROJECT = $PROJECT" +echo "PV_BIN = $PV_BIN" +echo "PV_CFG = $PV_CFG" +echo "PV_LIB = $PV_LIB" +echo "PV_DATA = $PV_DATA" +echo "PV_RESULTS = $PV_RESULTS" +echo "PV_LOG = $PV_LOG" +echo "PV_EXAMPLES = $PV_EXAMPLES" +echo "PYTHONPATH = $PYTHONPATH" +echo "================================================================" +echo "" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a895711 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +# Python-Abhaengigkeiten +# Installieren mit: pip install -r requirements.txt + +# Beispiel-Abhaengigkeiten - anpassen nach Bedarf: +# pydantic >= 2.0.0 +# pytest >= 9.0.0