-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
103 lines (90 loc) · 2.3 KB
/
setup.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
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
92
93
94
95
96
97
98
99
100
101
102
103
import os
import subprocess
# Directorios principales
config = 'config'
data = 'data'
docs = 'docs'
models = 'models'
reports = 'reports'
scripts = 'scripts'
source = 'source'
# Creación de los directorios principales
os.mkdir(config)
os.mkdir(data)
os.mkdir(docs)
os.mkdir(models)
os.mkdir(reports)
os.mkdir(scripts)
os.mkdir(source)
# Directorio data (carpetas)
clean = 'clean'
external = 'external'
interim = 'interim'
processed = 'processed'
raw = 'raw'
test = 'test'
# Creación de los directorios dentro de data
path = os.path.join(f'{data}/', clean)
os.mkdir(path)
path = os.path.join(f'{data}/', external)
os.mkdir(path)
path = os.path.join(f'{data}/', interim)
os.mkdir(path)
path = os.path.join(f'{data}/', processed)
os.mkdir(path)
path = os.path.join(f'{data}/', raw)
os.mkdir(path)
path = os.path.join(f'{data}/', test)
os.mkdir(path)
# Directorios de source (carpetas)
data = 'data'
features = 'features'
methods = 'methods'
models = 'models'
tests = 'tests'
# Creación de los directorios dentro de source
path = os.path.join(f'{source}/', data)
os.mkdir(path)
path = os.path.join(f'{source}/', features)
os.mkdir(path)
path = os.path.join(f'{source}/', methods)
os.mkdir(path)
path = os.path.join(f'{source}/', models)
os.mkdir(path)
path = os.path.join(f'{source}/', tests)
os.mkdir(path)
# Creación de los ficheros de config
config_py = f'{config}/config.py'
config_yaml = f'{config}/config.yaml'
try:
open(config_py, 'a').close()
open(config_yaml, 'a').close()
except OSError:
print('Failed creating the config files')
else:
print('Files created')
# Creación del fichero de documentación
documentation = f'{docs}/documentation.md'
try:
open(documentation, 'a').close()
except OSError:
print('Failed creating the doc file')
else:
print('Doc file created')
# Creación de los ficheros del programa principal
git = '.gitignore'
make = 'Makefile'
readme = 'README.md'
try:
open(git, 'a').close()
open(make, 'a').close()
open(readme, 'a').close()
except OSError:
print('Failed creating the main files')
else:
print('Main files created')
# Creación del fichero de requerimientos
command = "pip list --format=freeze > requirements.txt"
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=True)
#Launch the shell command:
output = process.communicate()[0]