-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
111 lines (81 loc) · 2.91 KB
/
Makefile
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
104
105
106
107
108
109
110
111
# ----------------------------------
# INSTALL & TEST
# ----------------------------------
install_requirements:
@pip install -r requirements.txt
check_code:
@flake8 scripts/* translating-the-law/*.py
black:
@black scripts/* translating-the-law/*.py
test:
@coverage run -m pytest tests/*.py
@coverage report -m --omit="${VIRTUAL_ENV}/lib/python*"
ftest:
@Write me
clean:
@rm -f */version.txt
@rm -f .coverage
@rm -fr */__pycache__ */*.pyc __pycache__
@rm -fr build dist
@rm -fr translating-the-law-*.dist-info
@rm -fr translating-the-law.egg-info
install:
@pip install . -U
all: clean install test black check_code
count_lines:
@find ./ -name '*.py' -exec wc -l {} \; | sort -n| awk \
'{printf "%4s %s\n", $$1, $$2}{s+=$$0}END{print s}'
@echo ''
@find ./scripts -name '*-*' -exec wc -l {} \; | sort -n| awk \
'{printf "%4s %s\n", $$1, $$2}{s+=$$0}END{print s}'
@echo ''
@find ./tests -name '*.py' -exec wc -l {} \; | sort -n| awk \
'{printf "%4s %s\n", $$1, $$2}{s+=$$0}END{print s}'
@echo ''
# ----------------------------------
# UPLOAD PACKAGE TO PYPI
# ----------------------------------
PYPI_USERNAME=<AUTHOR>
build:
@python setup.py sdist bdist_wheel
pypi_test:
@twine upload -r testpypi dist/* -u $(PYPI_USERNAME)
pypi:
@twine upload dist/* -u $(PYPI_USERNAME)
clean_up_pdf:
@find . -name "*.pdf" -type f -delete
# ----------------------------------
# HEROKU COMMANDS
# ----------------------------------
streamlit:
-@streamlit run translating_the_law/streamlit/app.py
heroku_login:
-@heroku login
heroku_create_app:
-@heroku create ${APP_NAME}
deploy_heroku:
-@git push heroku master
-@heroku ps:scale web=1
# Download
download_data:
@python3 translating_the_law/downloading/download_dataset.py
# project id - replace with your GCP project id
PROJECT_ID=translating-the-law
# bucket name - replace with your GCP bucket name
BUCKET_NAME=law-data-ogiles
# choose your region from https://cloud.google.com/storage/docs/locations#available_locations
REGION=europe-west2
set_project:
@gcloud config set project ${PROJECT_ID}
create_bucket:
@gsutil mb -l ${REGION} -p ${PROJECT_ID} gs://${BUCKET_NAME}
# path to the file to upload to GCP (the path to the file should be absolute or should match the directory where the make command is ran)
# replace with your local path to the `train_1k.csv` and make sure to put the path between quotes
LOCAL_PATH="/home/oliver/code/ogiles1999/translating-the-law/raw_data/simplified_data.json"
# bucket directory in which to store the uploaded file (`data` is an arbitrary name that we choose to use)
BUCKET_FOLDER=data
# name for the uploaded file inside of the bucket (we choose not to rename the file that we upload)
BUCKET_FILE_NAME=$(shell basename ${LOCAL_PATH})
#@gsutil cp train_1k.csv gs://wagon-data-805-giles/data/train_1k.csv
upload_data:
@gsutil cp ${LOCAL_PATH} gs://${BUCKET_NAME}/${BUCKET_FOLDER}/${BUCKET_FILE_NAME}