-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp.py
More file actions
40 lines (34 loc) · 1.05 KB
/
temp.py
File metadata and controls
40 lines (34 loc) · 1.05 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
import logging
import os
from pathlib import Path
logging.basicConfig(level=logging.INFO)
project_name = "src"
# Initilize the folder structure
list_of_folders = [
".github/workflow/.gitkeep",
f"{project_name}/components/__init__.py",
f"{project_name}/container/__init__.py",
f"{project_name}/core/__init__.py",
f"{project_name}/infrastructure/__init__.py",
f"{project_name}/interfaces/__init__.py",
f"{project_name}/logs/__init__.py",
f"{project_name}/utils/__init__.py",
"requirement.txt",
"setup.py",
"ui/__init__.py",
"backend/__init__.py",
".env",
".flake8",
]
for filepath in list_of_folders:
path = Path(filepath)
filedir = path.parent
filename = path.name
# Create directories if they don't exist
if filedir != Path(""):
os.makedirs(filedir, exist_ok=True)
logging.info("Created Directory: %s", filedir)
# Create files if they don't exist
if not path.exists():
path.touch() # correctly call touch()
logging.info("Created empty file: %s", filepath)