-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.py
62 lines (53 loc) · 1.54 KB
/
template.py
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
# importing necessary libraries:
import os
from pathlib import Path
import warnings
warnings.filterwarnings('ignore')
# package name:
package_name = 'dbsconnector'
# creating a list of files and folders required for the project:
list_of_files = [
# creating yaml files for git workflow (CI/CD):
'.github/workflows/ci.yaml',
'.github/workflows/python-publish.yaml',
# creating src folder where the actual package present:
'src/__init__.py',
# src ------> dbsconnector:
f'src/{package_name}/__init__.py',
f'src/{package_name}/databases.py',
# creating test folder:
'tests/__init__.py',
#tests -----> unit:
'tests/unit/__init__.py',
'tests/unit/test_unit.py',
# tests ----> integration:
'tests/integration/__init__.py',
'tests/integration/test_integration.py',
# setup files:
'setup.py',
'setup.cfg',
# requirements:
'requirements_dev.txt',
'requirements.txt',
# toml file:
'pyproject.toml',
# ini file:
'tox.ini',
# README file:
'README.md',
# jupyter notebook for experiments:
'experiments/experiments.ipynb'
]
# creating files and folders:
for filepath in list_of_files:
filepath = Path(filepath)
# getting directory and filename:
filedir, filename = os.path.split(filepath)
# creating directory:
if filedir!='':
os.makedirs(filedir, exist_ok=True)
# creating files:
if ( (not os.path.exists(filepath)) or (os.path.getsize(filepath)==0) ):
with open(filepath, 'w') as f:
pass
f.close()