From 385e33e8822e7fac1c086ad4f41ffbfbb571813e Mon Sep 17 00:00:00 2001 From: mistangl Date: Fri, 10 Apr 2026 12:11:52 +0200 Subject: [PATCH] alle Default files rein --- .gitignore | 89 +++++++++++++++++++++++++++++++++++++++ LICENSE | 21 ++++++++++ README.md | 98 +++++++++++++++++++++++++++++++++++++++++++ bin/activate_venv.bat | 20 +++++++++ bin/activate_venv.sh | 23 ++++++++++ bin/get_cmd.bat | 7 ++++ bin/get_cmd.sh | 12 ++++++ bin/install_py.bat | 22 ++++++++++ bin/install_py.sh | 23 ++++++++++ bin/setenv.bat | 57 +++++++++++++++++++++++++ bin/setenv.sh | 46 ++++++++++++++++++++ requirements.txt | 6 +++ 12 files changed, 424 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 bin/activate_venv.bat create mode 100644 bin/activate_venv.sh create mode 100644 bin/get_cmd.bat create mode 100644 bin/get_cmd.sh create mode 100644 bin/install_py.bat create mode 100644 bin/install_py.sh create mode 100644 bin/setenv.bat create mode 100644 bin/setenv.sh create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..61a9253 --- /dev/null +++ b/.gitignore @@ -0,0 +1,89 @@ +# ---> Python +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# IDEs +.spyderproject +.spyproject +.ropeproject +.mypy_cache/ +.dmypy.json +dmypy.json +.pyre/ +.pytype/ +cython_debug/ +.pdm.toml +__pypackages__/ +/site-packages +/site + +# Jupyter +.ipynb_checkpoints +profile_default/ +ipython_config.py + +# Benutzerdefiniert +/data +/work +/log +/results diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0a7fba9 --- /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..778812e --- /dev/null +++ b/README.md @@ -0,0 +1,98 @@ +# plantplan + +> Python-Projekttemplate mit Standard-Verzeichnisstruktur und Umgebungsverwaltung. + +## Projektstruktur + +``` +plantplan/ +├── 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 öffnen +├── 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 + +Nach dem Ausführen von `setenv` stehen folgende Variablen bereit: + +| 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 höher + +### Setup (Windows) + +```bat +bin\install_py.bat +``` + +### Setup (Linux / macOS) + +```bash +bash bin/install_py.sh +``` + +Erstellt `.venv` und installiert alle Pakete aus `requirements.txt`. + +## Nutzung + +### Umgebung setzen (Windows) + +```bat +bin\setenv.bat +``` + +### Umgebung setzen (Linux / macOS) + +```bash +source bin/setenv.sh +``` + +### Shell mit gesetzten Variablen öffnen + +```bat +bin\get_cmd.bat # Windows +source bin/get_cmd.sh # Linux / macOS +``` + +### venv aktivieren + +```bat +bin\activate_venv.bat # Windows +source bin/activate_venv.sh # Linux / macOS +``` + +## Lizenz + +MIT License — siehe [LICENSE](LICENSE) + +## Autor + +Michael Stangl (GitHub: mistamichael) diff --git a/bin/activate_venv.bat b/bin/activate_venv.bat new file mode 100644 index 0000000..d65505c --- /dev/null +++ b/bin/activate_venv.bat @@ -0,0 +1,20 @@ +@echo off +REM ================================================================ +REM PLANTPLAN - 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..fbfbf11 --- /dev/null +++ b/bin/activate_venv.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# ================================================================ +# PLANTPLAN - 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..2cbd7a8 --- /dev/null +++ b/bin/get_cmd.bat @@ -0,0 +1,7 @@ +@echo off +REM ================================================================ +REM PLANTPLAN - Shell mit gesetzten Umgebungsvariablen öffnen +REM ================================================================ + +call "%~dp0setenv.bat" +start cmd /k "echo PLANTPLAN Umgebung aktiv. && echo PROJECT=%PROJECT%" diff --git a/bin/get_cmd.sh b/bin/get_cmd.sh new file mode 100644 index 0000000..01207fd --- /dev/null +++ b/bin/get_cmd.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# ================================================================ +# PLANTPLAN - Shell mit gesetzten Umgebungsvariablen öffnen +# ================================================================ +# Verwendung: source bin/get_cmd.sh +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +# Neue interaktive Shell starten (mit gesetzten Umgebungsvariablen) +exec "$SHELL" diff --git a/bin/install_py.bat b/bin/install_py.bat new file mode 100644 index 0000000..086cc8f --- /dev/null +++ b/bin/install_py.bat @@ -0,0 +1,22 @@ +@echo off +REM ================================================================ +REM PLANTPLAN - Python Virtual Environment einrichten +REM ================================================================ +REM Erstellt .venv und installiert Abhängigkeiten aus requirements.txt +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..1bc9447 --- /dev/null +++ b/bin/install_py.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# ================================================================ +# PLANTPLAN - Python Virtual Environment einrichten +# ================================================================ +# Erstellt .venv und installiert Abhängigkeiten aus requirements.txt +# ================================================================ + +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..3596fc8 --- /dev/null +++ b/bin/setenv.bat @@ -0,0 +1,57 @@ +@echo off + +REM ================================================================ +REM PLANTPLAN - Umgebungsvariablen Setup +REM ================================================================ + +echo Setting up environment variables for PLANTPLAN ... + +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 für 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 +echo. +echo ================================================================ +echo PLANTPLAN 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..a946a2d --- /dev/null +++ b/bin/setenv.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# ================================================================ +# PLANTPLAN - Umgebungsvariablen Setup +# ================================================================ +# Dieses Skript muss gesourct werden: source bin/setenv.sh +# ================================================================ + +echo "Setting up environment variables for PLANTPLAN ..." + +# Basis-Projektpfad (übergeordnetes Verzeichnis von bin/) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +export PROJECT="$(cd "$SCRIPT_DIR/.." && pwd)" + +# Pfade für 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 "PLANTPLAN 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..7a0e909 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,6 @@ +# Python-Abhängigkeiten für plantplan +# Installieren mit: pip install -r requirements.txt + +# Beispiel-Abhängigkeiten – anpassen nach Bedarf: +# pydantic >= 2.0.0 +# pytest >= 9.0.0