61 lines
1.7 KiB
Python
Raw Normal View History

2025-08-21 00:34:47 +02:00
#!/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)