forked from SthembisoMfusi/PyDex
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
68 lines (56 loc) · 1.81 KB
/
setup.py
File metadata and controls
68 lines (56 loc) · 1.81 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env python3
"""
Setup script for PyDex
This script helps set up the development environment for PyDex.
"""
import subprocess
import sys
import os
def run_command(command, description):
print(f"🔄 {description}...")
try:
subprocess.run(command, check=True)
print(f"✅ {description} completed successfully!")
return True
except subprocess.CalledProcessError as e:
print(f"❌ {description} failed!")
return False
def main():
print("🚀 Setting up PyDex development environment...")
print()
# Check if Python is available
if sys.version_info < (3, 6):
print("❌ Python 3.6 or higher is required!")
sys.exit(1)
print(f"✅ Python {sys.version.split()[0]} detected")
# Create virtual environment
if not os.path.exists("venv"):
if not run_command("python -m venv venv", "Creating virtual environment"):
sys.exit(1)
else:
print("✅ Virtual environment already exists")
# Activate virtual environment and install requirements
if os.name == "nt":
venv_python = os.path.join("venv", "Scripts", "python")
else:
venv_python = os.path.join("venv", "bin", "python")
if not run_command(
[venv_python, "-m", "pip", "install", "-r", "requirements.txt"],
"Installing dependencies"
):
sys.exit(1)
print()
print("🎉 Setup completed successfully!")
print()
print("To activate the virtual environment:")
if os.name == 'nt': # Windows
print(" venv\\Scripts\\activate")
else: # Unix/Linux/macOS
print(" source venv/bin/activate")
print()
print("To run PyDex:")
print(" python pokedex.py pikachu")
print()
print("Happy coding! 🐍")
if __name__ == "__main__":
main()