61 lines
1.7 KiB
Python
61 lines
1.7 KiB
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
import os
|
||
|
import sys
|
||
|
import subprocess
|
||
|
from pathlib import Path
|
||
|
|
||
|
|
||
|
def run_command(command, check=True):
|
||
|
print(f"Running: {command}")
|
||
|
result = subprocess.run(command, shell=True, check=check)
|
||
|
return result.returncode == 0
|
||
|
|
||
|
|
||
|
def install_pyr():
|
||
|
print("๐ Installing PYR - Python R Vibe Tool")
|
||
|
print("=" * 50)
|
||
|
|
||
|
project_root = Path(__file__).parent.parent
|
||
|
os.chdir(project_root)
|
||
|
|
||
|
print("๐ฆ Installing dependencies...")
|
||
|
if not run_command("pip install -e ."):
|
||
|
print("โ Failed to install dependencies")
|
||
|
return False
|
||
|
|
||
|
print("๐ง Installing development dependencies...")
|
||
|
if not run_command("pip install -e .[dev]"):
|
||
|
print("โ ๏ธ Failed to install development dependencies (continuing...)")
|
||
|
|
||
|
print("๐ Creating default configuration...")
|
||
|
env_example = project_root / ".env.example"
|
||
|
env_file = project_root / ".env"
|
||
|
|
||
|
if not env_file.exists() and env_example.exists():
|
||
|
env_file.write_text(env_example.read_text())
|
||
|
print(f"โ
Created {env_file}")
|
||
|
|
||
|
print("๐งช Running tests...")
|
||
|
if not run_command("python -m pytest tests/ -v", check=False):
|
||
|
print("โ ๏ธ Some tests failed (continuing...)")
|
||
|
|
||
|
print("โ
PYR installation completed!")
|
||
|
print("\n๐ Quick Start:")
|
||
|
print(" pyr --help")
|
||
|
print(" pyr 'Hello, how can you help me?'")
|
||
|
print(" pyr # Start interactive REPL")
|
||
|
|
||
|
return True
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
try:
|
||
|
if install_pyr():
|
||
|
sys.exit(0)
|
||
|
else:
|
||
|
sys.exit(1)
|
||
|
except KeyboardInterrupt:
|
||
|
print("\nโ Installation cancelled by user")
|
||
|
sys.exit(130)
|