From d07ee2edd6f497dbc4ccd272815fdc6acb2bd95e Mon Sep 17 00:00:00 2001 From: Bastien Vial-Collet Date: Thu, 12 Dec 2024 13:44:26 +0100 Subject: [PATCH] fix(build): add venv activation to commands and improve error handling --- justfile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/justfile b/justfile index f0e6f95..736374a 100644 --- a/justfile +++ b/justfile @@ -4,15 +4,19 @@ default: # Create and activate virtual environment venv: - python -m venv venv - @echo "Virtual environment created. Activate it with 'source venv/bin/activate' (Unix) or 'venv\\Scripts\\activate' (Windows)" + python3 -m venv venv || (echo "Error: Failed to create virtual environment. Make sure python3 and python3-venv are installed." && exit 1) + echo "Virtual environment created. Activate it with 'source venv/bin/activate' (Unix) or 'venv\\Scripts\\activate' (Windows)" # Install required packages (run after activating venv) install: + #!/usr/bin/env bash + source venv/bin/activate pip install -r requirements.txt # Run the Streamlit application run: + #!/usr/bin/env bash + source venv/bin/activate streamlit run scrape_ui.py # Verify all required files exist @@ -27,8 +31,10 @@ setup: verify venv install run # Initialize or reset the database schema init-db: + #!/usr/bin/env bash + source venv/bin/activate @echo "Initializing database schema..." - @python -c "from scrape_ui import init_db; init_db()" + python -c "from scrape_ui import init_db; init_db()" # Clean the database (removes all stored URLs) clean-db: