chore(db): wire ensure_venv() into connector scripts

Add venv auto-activation to audio_batch, audio_connector,
image_connector, qdrant_connector, and trellis_connector.
Scripts re-exec into .venv/bin/python when invoked outside
the venv, with a friendly error if .venv is missing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 09:39:55 +02:00
co-authored by Claude Opus 4.6
parent d86ebada8d
commit 980201fb49
5 changed files with 49 additions and 14 deletions
+11 -5
View File
@@ -8,12 +8,18 @@ Usage:
python3 audio_batch.py manifest.json [--dry-run] [--only ID,ID,...] [--skip-existing]
"""
import json
import math
import os
import struct
import subprocess
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from common import ensure_venv # noqa: E402
ensure_venv()
import json
import os
import subprocess
import wave
import numpy as np
+10 -2
View File
@@ -10,14 +10,22 @@ Usage:
python3 audio_connector.py health
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from common import ensure_venv # noqa: E402
ensure_venv()
import json
import os
import shutil
import subprocess
import sys
import time
import urllib.error
import urllib.request
import shutil
CONFIG_PATH = os.path.join(os.path.dirname(__file__), "config.json")
+9 -1
View File
@@ -10,10 +10,18 @@ Usage:
python3 image_connector.py generate "prompt" [--output file.png] [--aspect 1:1] [--size 1K] [--input image.png]
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from common import ensure_venv # noqa: E402
ensure_venv()
import base64
import json
import os
import sys
import urllib.error
import urllib.request
+9 -3
View File
@@ -14,14 +14,20 @@ Usage:
Requires only Python 3 stdlib (no pip dependencies).
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from common import ensure_venv # noqa: E402
ensure_venv()
import hashlib
import json
import os
import re
import sys
import urllib.error
import urllib.request
from pathlib import Path
# ---------------------------------------------------------------------------
# Paths / Config
+10 -3
View File
@@ -36,15 +36,22 @@ Gradio API Parameter Reference (TRELLIS v1, microsoft/TRELLIS):
- CUDA device mismatch after crash: restart the container to clear GPU state
"""
import base64
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from common import ensure_venv # noqa: E402
ensure_venv()
import json
import os
import shutil
import sys
import time
import urllib.error
import urllib.request
import urllib.parse
import urllib.request
CONFIG_PATH = os.path.join(os.path.dirname(__file__), "config.json")