-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.py
More file actions
76 lines (70 loc) · 2.87 KB
/
template.py
File metadata and controls
76 lines (70 loc) · 2.87 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
# Template for Vehicle Insurance Data Pipeline ML Ops
"""
Template script for creating new modules or scripts in the Vehicle Insurance Data Pipeline MLops project.
"""
# Author: Shalin Vachheta
# Date:14/12/2025
# Template for Vehicle Insurance Data Pipeline ML Ops
import os
from pathlib import Path
# Author: Shalin Vachheta
# Date:14/12/2025
# Description: This script serves as a template for building a data pipeline and ML workflow for vehicle insurance data.
# Define the main project directory name
project_name ="src"
# List of files and directories to be created for the ML Ops project structure
list_of_files = [
f"{project_name}/__init__.py",
f"{project_name}/components/__init__.py",
f"{project_name}/components/data_ingestion.py",
f"{project_name}/components/data_validation.py",
f"{project_name}/components/data_transformation.py",
f"{project_name}/components/model_trainer.py",
f"{project_name}/components/model_evaluation.py",
f"{project_name}/components/model_pusher.py",
f"{project_name}/configuration/__init__.py",
f"{project_name}/configuration/mongo_db_connection.py" ,
f"{project_name}/configuration/aws_connection.py",
f"{project_name}/cloud_storage/__init__.py",
f"{project_name}/cloud_storage/aws_storage.py",
f"{project_name}/data_access/__init__.py",
f"{project_name}/data_access/proj1_data.py",
f"{project_name}/constants/__init__.py",
f"{project_name}/entity/__init__.py",
f"{project_name}/entity/config_entity.py",
f"{project_name}/entity/artifact_entity.py",
f"{project_name}/entity/estimator.py",
f"{project_name}/entity/s3_estimator.py",
f"{project_name}/exception/__init__.py",
f"{project_name}/logger/__init__.py",
f"{project_name}/pipline/__init__.py",
f"{project_name}/pipline/training_pipeline.py",
f"{project_name}/pipline/prediction_pipeline.py",
f"{project_name}/utils/__init__.py",
f"{project_name}/utils/main_utils.py",
"app.py",
"requirements.txt",
"Dockerfile",
"setup.py",
"demo.py",
"pyproject.toml",
"config/model.yaml",
"config/scema.yaml",
]
# Create the directories and files as specified in the list
for filepath in list_of_files:
# Convert the filepath string to a Path object for easier manipulation
filepath = Path(filepath)
# Split the filepath into directory and filename
filedir, filename = os.path.split(filepath)
# If there is a directory part, create it if it doesn't exist
if filedir != "":
os.makedirs(filedir, exist_ok=True)
print(f"Creating directory: {filedir} for file: {filename}")
# If the file doesn't exist or is empty, create it
if (not os.path.exists(filepath)) or (os.path.getsize(filepath) == 0):
with open(filepath, "w") as f:
pass
print(f"Creating file: {filepath}")
else:
print(f"File already exists: {filepath}")