-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (63 loc) · 1.77 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
#package specific stuff
PACKNAME=visla
TESTDIR=tests
#useful general variables
VENV=test_venv
ACTIVATE=$(VENV)/bin/activate
VENVPIP=$(VENV)/bin/pip
SANDBOX=sbox/sandbox.py
#create/update virtual environment for testing
update-venv:
@#operations in order:
@#make virtual environment
@#activate virtual environment
@#install package to be tested in editable form (automatically gets dependencies)
@#deactivate virtual environment
@#all above directed to shell (necessary)
@(\
virtualenv $(VENV); \
source $(ACTIVATE); \
$(VENVPIP) install -e .; \
deactivate; \
)
#test using virtual environment
test:
@#operations in order:
@#activate virtual environment
@#run all scripts in $(TESTDIR) directory
@#deactivate virtual environment
@#all directed to shell (necessary)
@(\
source $(ACTIVATE); \
for f in $(TESTDIR)/*.py; do python "$$f"; done; \
deactivate; \
)
#development sandbox for on the fly testing
sandbox:
@(\
source $(ACTIVATE); \
python $(SANDBOX); \
deactivate; \
)
#install package locally (user/non-venv environment) in editable form
local-install:
@pip uninstall $(PACKNAME)
@pip install -e .
#uninstall editable package from user/non-venv environment
local-uninstall:
@pip uninstall $(PACKNAME)
#print TODO notes to terminal
todo:
grep -r -i "todo" $(PACKNAME) $(TESTDIR)
#remove virtual environment
clean:
@\rm -rf test_venv
#STEPS TO CREATE PYTHON PACKAGE
#(for full guide see DZone's "Build your first pip package")
# 0. create setup.py file (already included, just fill appropriately)
# 0.1 address bin/<PACKAGE_NAME> executable (just rename)
# 1. python setup.py bdist_wheel
# 2. ensure ~/.pyirc file exists
# 3. $ python -m twine upload dist/*
# if updating, before step 1: bump version number
# clear dist/* of old versions