Skip to content

Commit

Permalink
fix(build): add venv activation to commands and improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
vialcollet committed Dec 12, 2024
1 parent b6ce16f commit d07ee2e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit d07ee2e

Please sign in to comment.