summaryrefslogtreecommitdiff
path: root/Makefile
blob: cafda8ebb075c0630667508fa8ebf8f626e27aad (plain)
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
PYTHON=python3
branch := $(shell git symbolic-ref --short -q HEAD)



help :
	@echo "The following make targets are available:"
	@echo "    help - print this message"
	@echo "    build - build python package"
	@echo "    install - install python package (local user)"
	@echo "    sinstall - install python package (system with sudo)"
	@echo "    remove - remove the package (local user)"
	@echo "    sremove - remove the package (system with sudo)"
	@echo "    clean - remove any temporary files"
	@echo "    notebook - launch ipython notebook"

build :
	$(PYTHON) setup.py build

buildext :
	$(PYTHON) setup.py build_ext --inplace

install :
	$(PYTHON) setup.py install --user

sinstall :
	sudo $(PYTHON) setup.py install

remove :
	$(PYTHON) setup.py install --user --record files.txt
	tr '\n' '\0' < files.txt | xargs -0 rm -f --
	rm files.txt

sremove :
	$(PYTHON) setup.py install  --record files.txt
	tr '\n' '\0' < files.txt | sudo xargs -0 rm -f --
	rm files.txt

clean : FORCE
	$(PYTHON) setup.py clean

pep8 :
	flake8 examples/ ot/ test/

test : FORCE pep8
	$(PYTHON) -m pytest -v test/ --doctest-modules --ignore ot/gpu/  --cov=ot --cov-report html:cov_html
	
pytest : FORCE 
	$(PYTHON) -m pytest -v test/ --doctest-modules --ignore ot/gpu/  --cov=ot

release :
	twine upload dist/*

release_test :
	twine upload --repository-url https://test.pypi.org/legacy/ dist/*

rdoc :
	pandoc --from=markdown --to=rst --output=docs/source/readme.rst README.md

notebook :
	ipython notebook --matplotlib=inline  --notebook-dir=notebooks/
	
bench : 
	@git stash  >/dev/null 2>&1
	@echo 'Branch master'
	@git checkout master >/dev/null 2>&1
	python3 $(script)
	@echo 'Branch $(branch)'
	@git checkout $(branch) >/dev/null 2>&1
	python3 $(script)
	@git stash apply >/dev/null 2>&1
	
autopep8 :
	autopep8 -ir test ot examples --jobs -1

aautopep8 :
	autopep8 -air test ot examples --jobs -1
	
wheels :
	CIBW_BEFORE_BUILD="pip install numpy cython" cibuildwheel --platform linux --output-dir dist

dist : wheels
	$(PYTHON) setup.py sdist


pydocstyle :
	pydocstyle ot

FORCE :