-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtemplate.py
More file actions
49 lines (42 loc) · 1.4 KB
/
Copy pathtemplate.py
File metadata and controls
49 lines (42 loc) · 1.4 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
import os
import logging
logging.basicConfig(level=logging.INFO)
# Make a folder structure
folders=[
os.path.join("Data","raw"),
os.path.join("Data","process"),
os.path.join("src","components"),
os.path.join("src","model-training"),
]
for folder in folders:
if not os.path.exists(folder):
os.makedirs(folder,exist_ok=True)
# Now make a git keefile inside the each folder
git_keep=os.path.join(folder,".gitkeep")
with open(git_keep,"w")as f:
pass
else:
logging.info(f"{folder} already present")
# Now inject the files for each folder
folder_files=[
os.path.join("src","__init__.py"),
os.path.join("src","utils.py"),
os.path.join("src/components","__init__.py"),
os.path.join("src/components","data_loader.py"),
os.path.join("src/components","data_processor.py"),
os.path.join("src/components","data_visulization.py"),
os.path.join("src/components","feature_engnering.py"),
os.path.join("src/model-training","__init__.py"),
os.path.join("src/model-training","train_model.py"),
"setup.py",
"test_environment.py",
"requirements.txt",
"app.py"
]
for file in folder_files:
if not os.path.exists(file) or os.path.getsize(file) == 0:
with open(file,"w") as f:
pass
logging.info(f"{file} created successfully")
else:
logging.info(f"{file} already present")