-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
52 lines (44 loc) · 1.58 KB
/
setup.py
File metadata and controls
52 lines (44 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python3
"""
Setup script for the Advanced Sorting Algorithm Visualizer
"""
import subprocess
import sys
import os
def install_requirements():
"""Install required packages"""
print("Installing requirements...")
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("✅ Requirements installed successfully!")
except subprocess.CalledProcessError:
print("❌ Failed to install requirements")
sys.exit(1)
def run_visualizer():
"""Run the sorting visualizer"""
print("Starting the Advanced Sorting Algorithm Visualizer...")
try:
subprocess.run([sys.executable, "main.py"])
except KeyboardInterrupt:
print("\n👋 Thanks for using the Sorting Algorithm Visualizer!")
except Exception as e:
print(f"❌ Error running visualizer: {e}")
def main():
"""Main setup function"""
print("🎯 Advanced Sorting Algorithm Visualizer Setup")
print("=" * 50)
# Check if requirements.txt exists
if not os.path.exists("requirements.txt"):
print("❌ requirements.txt not found!")
sys.exit(1)
# Install requirements
install_requirements()
# Ask user if they want to run the visualizer
response = input("\nWould you like to run the visualizer now? (y/n): ").lower()
if response in ['y', 'yes']:
run_visualizer()
else:
print("\n📝 To run the visualizer later, use: python main.py")
print("📚 Check README.md for controls and usage instructions")
if __name__ == "__main__":
main()