From c92973921068b4a0dbc291d4cc342b80285be5c3 Mon Sep 17 00:00:00 2001 From: WorldTeacher Date: Fri, 24 Jan 2025 08:10:59 +0100 Subject: [PATCH] add omegaconf dependency, rework launch scripts to check if venv exists --- launch.cmd | 28 +++++++++++++++++++--------- launch.ps1 | 28 +++++++++++++++++++--------- pyproject.toml | 2 +- 3 files changed, 39 insertions(+), 19 deletions(-) diff --git a/launch.cmd b/launch.cmd index 676d655..e5a90e3 100644 --- a/launch.cmd +++ b/launch.cmd @@ -1,16 +1,26 @@ @echo off -REM Activate Python virtual environment -cd . -call .venv\Scripts\activate.bat +REM Check if .venv exists +if exist .venv ( + REM Activate the virtual environment + call .venv\Scripts\activate.bat +) else ( + REM Run uv sync if .venv does not exist + uv sync + call .venv\Scripts\activate.bat +) -REM Perform a git pull to sync the repository +REM Perform a git pull git pull -REM Run uv sync (replace 'uv sync' with the actual command if different) -uv sync +REM Run uv sync if .venv exists (already activated) +if exist .venv ( + uv sync +) -REM Start the Python script +REM Start main.py python main.py -REM Deactivate the virtual environment -deactivate +REM Deactivate the virtual environment if it was activated +if exist .venv ( + deactivate +) \ No newline at end of file diff --git a/launch.ps1 b/launch.ps1 index 90a49a6..6ad66ab 100644 --- a/launch.ps1 +++ b/launch.ps1 @@ -1,15 +1,25 @@ -# Activate Python virtual environment -Set-Location -Path "." -.venv\Scripts\Activate.ps1 +# Check if .venv exists +if (Test-Path .venv) { + # Activate the virtual environment + .\.venv\Scripts\Activate.ps1 +} else { + # Run uv sync if .venv does not exist + uv sync + .\.venv\Scripts\Activate.ps1 +} -# Perform a git pull to sync the repository +# Perform a git pull git pull -# Run uv sync (replace 'uv sync' with the actual command if different) -uv sync +# Run uv sync if .venv exists (already activated) +if (Test-Path .venv) { + uv sync +} -# Start the Python script +# Start main.py python main.py -# Deactivate the virtual environment -deactivate +# Deactivate the virtual environment if it was activated +if (Test-Path .venv) { + deactivate +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 094ddb3..0572b27 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,4 +36,4 @@ indent-width = 4 include = ["pyproject.toml", "src/**/*.py", "scripts/**/*.py","tests/**/*.py"] [tool.ruff.lint] -fixable = ["ALL"] \ No newline at end of file +fixable = ["ALL"]