From a4167b814d6086b5b3de5a25cee2688559ecc31d Mon Sep 17 00:00:00 2001 From: Bruno Amrim Date: Tue, 25 Nov 2025 14:40:29 -0300 Subject: [PATCH] Add: Setup local virtual environment for build dependencies Introduced a new function `setup_build_venv` in `setup.sh` to create a local virtual environment for build dependencies. The function prompts the user for confirmation and attempts to use `uv` for a faster setup, falling back to the standard `venv` if necessary. The virtual environment is activated after creation. This enhancement streamlines the build process by ensuring necessary dependencies are isolated and managed effectively. --- setup.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/setup.sh b/setup.sh index 53f9680c..094ed9d2 100755 --- a/setup.sh +++ b/setup.sh @@ -1054,6 +1054,38 @@ setup_s3_mount() { fi } +setup_build_venv() { + if prompt_yes_no "Create local virtual environment for build dependencies?" "y"; then + info "Setting up virtual environment..." + + if check_command uv; then + info "Using uv for fast setup..." + if uv venv .venv && uv pip install e2b; then + success "Virtual environment created with uv" + else + warning "Failed to create venv with uv, falling back to standard venv" + if python3 -m venv .venv && .venv/bin/pip install e2b; then + success "Virtual environment created" + else + error "Failed to create venv" + return 1 + fi + fi + else + info "Using standard python venv..." + if python3 -m venv .venv && .venv/bin/pip install e2b; then + success "Virtual environment created" + else + error "Failed to create venv" + return 1 + fi + fi + + info "Activating virtual environment..." + source .venv/bin/activate + fi +} + build_e2b_template() { step "Building E2B v2 Template (Optional)" @@ -1109,6 +1141,9 @@ build_e2b_template() { info "E2B API key loaded, building dev template..." cd "$e2b_dir" + # Setup virtual environment if requested + setup_build_venv + # E2B v2 approach: Use Python SDK with environment variables info "Building template using E2B v2 Python SDK..." info "Template features: Runtime S3 mounting, parallel initialization"