Skip to content

Commit 1c07237

Browse files
commit
1 parent 4dcd317 commit 1c07237

File tree

3 files changed

+365
-133
lines changed

3 files changed

+365
-133
lines changed

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PySide6>=6.5.0
2+
markdown>=3.4.0
3+
pygments>=2.15.0

run_prompt_editor.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# Simple wrapper to create/activate a virtualenv and launch the prompt editor GUI.
4+
# Use uv to manage venv, install deps, and run the prompt editor GUI.
55

66
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
77
REPO_ROOT="$SCRIPT_DIR"
88
VENV_DIR="${REPO_ROOT}/.venv"
99
PYTHON_BIN="${PYTHON:-python3}"
1010

11+
if ! command -v uv >/dev/null 2>&1; then
12+
echo "[run] Error: 'uv' is not installed or not on PATH." >&2
13+
echo "[run] Please install uv: https://docs.astral.sh/uv/ and re-run." >&2
14+
exit 1
15+
fi
16+
1117
echo "[run] Using python: ${PYTHON_BIN}"
1218

1319
if [[ ! -d "${VENV_DIR}" ]]; then
14-
echo "[run] Creating virtual environment at ${VENV_DIR}"
15-
"${PYTHON_BIN}" -m venv "${VENV_DIR}"
20+
echo "[run] Creating virtual environment with uv at ${VENV_DIR}"
21+
uv venv --python "${PYTHON_BIN}" "${VENV_DIR}"
1622
fi
1723

24+
# Activate the environment created by uv
1825
source "${VENV_DIR}/bin/activate"
1926
echo "[run] Virtualenv activated: ${VENV_DIR}"
2027

21-
# If a requirements file exists, install it (best-effort). Skip if offline.
28+
# Install dependencies using uv
2229
REQ_FILE="${REPO_ROOT}/requirements.txt"
23-
if [[ -f "${REQ_FILE}" ]]; then
24-
echo "[run] Installing dependencies from requirements.txt (if network available)"
25-
pip install -r "${REQ_FILE}" || echo "[run] pip install skipped/failed (likely offline). Continuing."
30+
PYPROJECT_FILE="${REPO_ROOT}/pyproject.toml"
31+
if [[ -f "${PYPROJECT_FILE}" ]]; then
32+
echo "[run] Installing dependencies via 'uv sync' (pyproject.toml)"
33+
uv sync || echo "[run] uv sync failed/skipped (possibly offline); continuing."
34+
elif [[ -f "${REQ_FILE}" ]]; then
35+
echo "[run] Installing dependencies from requirements.txt via 'uv pip'"
36+
uv pip install -r "${REQ_FILE}" || echo "[run] uv pip failed/skipped (possibly offline); continuing."
37+
else
38+
echo "[run] No dependency file found (pyproject.toml or requirements.txt); skipping install."
2639
fi
2740

2841
echo "[run] Launching GUI..."
2942
exec python "${REPO_ROOT}/scripts/prompt_editor.py" "$@"
30-

0 commit comments

Comments
 (0)