forked from okfn-brasil/serenata-de-amor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·29 lines (19 loc) · 896 Bytes
/
setup
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
#!/usr/bin/env python3
import os
import pip
from shutil import copyfile, which
RESEARCH_DIR = 'research'
DATA_DIR = os.path.join(RESEARCH_DIR, 'data')
if not os.path.exists('config.ini'):
copyfile('config.ini.example', 'config.ini')
requirements = os.path.join(RESEARCH_DIR, 'requirements.txt') # local install
if not os.path.exists(requirements):
requirements = 'requirements.txt' # Docker
pip.main(['install', '--upgrade', '-r', requirements])
if which('unzip') == None:
print('The following executables are needed and were not found: unzip')
print('Downloading datasets (this might take several minutes depending on your internet connection)')
# This is imported here because serenata_toolbox is only installed when pip.main is called (line 9)
from serenata_toolbox.datasets import fetch_latest_backup
os.makedirs(DATA_DIR, exist_ok=True)
fetch_latest_backup(DATA_DIR)