-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_project.py
More file actions
91 lines (71 loc) · 1.96 KB
/
setup_project.py
File metadata and controls
91 lines (71 loc) · 1.96 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import os
import shutil
# -----------------------------------------
# PROJECT SETUP SCRIPT FOR INVOICE AUTOMATION
# Creates folder structure, moves files safely,
# generates .env and requirements.
# -----------------------------------------
# Folders to create
folders = ["src", "data", "logs", "backup"]
# Files to move into src/
python_files = [
"main.py",
"day6_reminder_advanced.py",
"csv_helper.py",
"email_helper.py",
"log_helper.py",
"pdf_report.py",
"dashboard.py",
"auth.py"
]
# CSV files → data/
csv_files = [
"invoices.csv",
"invoices_updated.csv"
]
# Log files → logs/
log_files = [
"sent_log.txt",
"summary.pdf"
]
def safe_move(file, dest):
"""Move a file unless the destination already has the same name."""
if not os.path.exists(file):
print(f"Skipping {file}, not found.")
return
target = os.path.join(dest, os.path.basename(file))
if os.path.exists(target):
print(f"Skipping {file}, already in {dest}")
else:
shutil.move(file, dest)
print(f"Moved: {file} → {dest}")
print("\n=== Setting Up Project Structure ===\n")
# Create folders
for folder in folders:
os.makedirs(folder, exist_ok=True)
print(f"Folder ready: {folder}")
print("\n=== Moving Python Source Files ===")
for file in python_files:
safe_move(file, "src")
print("\n=== Moving Invoices (CSV Files) ===")
for file in csv_files:
safe_move(file, "data")
print("\n=== Moving Log Files ===")
for file in log_files:
safe_move(file, "logs")
# Create .env if not exists
if not os.path.exists(".env"):
with open(".env", "w") as f:
f.write("EMAIL_USER=\nEMAIL_PASS=\n")
print("\nCreated .env template")
# Create requirements.txt
requirements = """python-dotenv
colorama
reportlab
flask
pandas
"""
with open("requirements.txt", "w") as f:
f.write(requirements)
print("Created requirements.txt")
print("\n=== Setup Complete! ===\nYour project is ready to run.\n")