-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from VinciGit00/master
Create install.sh
- Loading branch information
Showing
4 changed files
with
258 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
#!/bin/bash | ||
|
||
# Parse options | ||
install_playwright=false | ||
while getopts "p" opt; do | ||
case ${opt} in | ||
p ) install_playwright=true ;; | ||
\? ) echo "Usage: install.sh [-p]" ;; | ||
esac | ||
done | ||
|
||
# Function to check if a command exists | ||
command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
echo "🤖 Installing Agent-E..." | ||
|
||
# Check Python version | ||
if ! command_exists python3; then | ||
echo "❌ Python 3 is required but not installed. Please install Python 3.10 or higher." | ||
exit 1 | ||
fi | ||
|
||
# Playwright installation check | ||
if [ "$install_playwright" = false ]; then | ||
read -p "Would you like to install Playwright drivers? (y/n) " -n 1 -r | ||
echo | ||
if [[ $REPLY =~ ^[Yy]$ ]]; then | ||
install_playwright=true | ||
fi | ||
fi | ||
|
||
# Install uv if not present | ||
if ! command_exists uv; then | ||
echo "📦 Installing uv package manager..." | ||
curl -LsSf https://astral.sh/uv/install.sh | sh | ||
|
||
# Add uv to current shell session | ||
export PATH="$HOME/.cargo/bin:$PATH" | ||
fi | ||
|
||
# Create and activate virtual environment | ||
echo "🔧 Creating virtual environment..." | ||
uv venv --python 3.11 | ||
|
||
# Determine the activation script based on OS | ||
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then | ||
if [ -f .venv/Scripts/activate ]; then | ||
source .venv/Scripts/activate | ||
else | ||
echo "❌ Virtual environment activation script not found. Ensure virtual environment is created successfully." | ||
exit 1 | ||
fi | ||
else | ||
if [ -f .venv/bin/activate ]; then | ||
source .venv/bin/activate | ||
else | ||
echo "❌ Virtual environment activation script not found. Ensure virtual environment is created successfully." | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Install dependencies | ||
echo "📚 Installing dependencies..." | ||
uv pip compile pyproject.toml -o requirements.txt | ||
uv pip install -r requirements.txt | ||
|
||
# Install development dependencies | ||
echo "🛠️ Installing development dependencies..." | ||
uv pip install -r pyproject.toml --extra dev | ||
|
||
# Optional Playwright installation | ||
if [ "$install_playwright" = true ]; then | ||
echo "🎭 Installing Playwright..." | ||
playwright install | ||
fi | ||
|
||
# Create .env file if it doesn't exist | ||
new_env_file_created=false | ||
if [ ! -f .env ]; then | ||
echo "📝 Creating .env file..." | ||
cp .env-example .env | ||
new_env_file_created=true | ||
fi | ||
|
||
# Create agents_llm_config.json if it doesn't exist | ||
new_agents_llm_config=false | ||
if [ ! -f agents_llm_config.json ]; then | ||
echo "📝 Creating agents_llm_config.json file..." | ||
cp agents_llm_config-example.json agents_llm_config.json | ||
new_agents_llm_config=true | ||
fi | ||
|
||
echo "✅ Installation complete!" | ||
|
||
# Configuration guidance | ||
if [ "$new_env_file_created" = true ]; then | ||
echo "⚠️ Please edit the .env file with your API keys and configuration." | ||
fi | ||
|
||
if [ "$new_agents_llm_config" = true ]; then | ||
echo "⚠️ Please edit the agents_llm_config.json file with your LLM configuration." | ||
fi | ||
|
||
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then | ||
echo "🚀 To start Agent-E, activate the virtual environment (source .venv/Scripts/activate) and run: python -m ae.main" | ||
else | ||
echo "🚀 To start Agent-E, activate the virtual environment (source .venv/bin/activate) and run: python -u -m ae.main" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
param ( | ||
[switch]$p # Short flag to install Playwright | ||
) | ||
|
||
Write-Output "Installing Agent-E..." | ||
|
||
# Function to check if a command exists | ||
function Command-Exists { | ||
param ( | ||
[string]$Command | ||
) | ||
return $null -ne (Get-Command $Command -ErrorAction SilentlyContinue) | ||
} | ||
|
||
# Check Python version | ||
if (-not (Command-Exists 'python3')) { | ||
Write-Output "Python 3 is required but not installed. Please install Python 3.10 or higher." | ||
exit 1 | ||
} | ||
|
||
# Ask the user about Playwright installation if the flag is not provided | ||
$installPlaywright = $false | ||
if (-not $p) { | ||
$response = Read-Host "Would you like to install Playwright drivers? (y/n)" | ||
if ($response -match '^[Yy]$') { | ||
$installPlaywright = $true | ||
} | ||
} else { | ||
$installPlaywright = $true | ||
} | ||
|
||
# Install `uv` if not present | ||
if (-not (Command-Exists 'uv')) { | ||
Write-Output "Installing uv package manager..." | ||
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://astral.sh/uv/install.ps1')) | ||
|
||
# Add uv to current session | ||
$cargoBinPath = Join-Path $HOME ".cargo/bin" | ||
$env:PATH = "$env:PATH;$cargoBinPath" | ||
} | ||
|
||
# Create and activate virtual environment | ||
Write-Output "Creating virtual environment..." | ||
uv venv --python 3.11 | ||
|
||
# Activate virtual environment | ||
if (Test-Path ".venv\Scripts\Activate.ps1") { | ||
. .venv\Scripts\Activate.ps1 | ||
} else { | ||
Write-Output "Virtual environment activation script not found. Ensure virtual environment is created successfully." | ||
exit 1 | ||
} | ||
|
||
# Install dependencies | ||
Write-Output "Installing dependencies..." | ||
uv pip compile pyproject.toml -o requirements.txt | ||
uv pip install -r requirements.txt | ||
|
||
# Install development dependencies | ||
Write-Output "Installing development dependencies..." | ||
uv pip install -r pyproject.toml --extra dev | ||
|
||
# Optional Playwright installation | ||
if ($installPlaywright) { | ||
Write-Output "Installing Playwright..." | ||
playwright install | ||
} | ||
|
||
$new_env_file_created = $false | ||
# Create .env file if it doesn't exist | ||
if (-not (Test-Path ".env")) { | ||
$new_env_file_created = $true | ||
Write-Output "Creating .env file..." | ||
Copy-Item ".env-example" ".env" | ||
Write-Output "Please edit .env file with your API keys and configuration" | ||
} | ||
|
||
$new_agents_llm_config = $false | ||
if (-not (Test-Path "agents_llm_config.json")) { | ||
$new_agents_llm_config = $true | ||
Write-Output "Creating agents_llm_config.json" | ||
Copy-Item "agents_llm_config-example.json" "agents_llm_config.json" | ||
Write-Output "Please edit agents_llm_config.json file with your LLM config" | ||
} | ||
|
||
Write-Output "Installation complete!" | ||
Write-Output "To start Agent-E, activate the virtual environment (source .venv/Scripts/activate) and run: python -m ae.main" | ||
|
||
if ($new_env_file_created) { | ||
Write-Output "Don't forget to configure your .env file with the necessary API keys and settings." | ||
} | ||
|
||
if ($new_agents_llm_config) { | ||
Write-Output "Don't forget to configure agents_llm_config.json" | ||
} |