-
Notifications
You must be signed in to change notification settings - Fork 602
/
Makefile
84 lines (71 loc) · 2.52 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
PYTHON3 := $(shell which python3 2>/dev/null)
PYTHON := python3
COVERAGE := --cov=pennylane --cov-report term-missing --cov-report=html:coverage_html_report
TESTRUNNER := -m pytest tests --tb=native --no-flaky-report
PLUGIN_TESTRUNNER := -m pytest pennylane/devices/tests --tb=native --no-flaky-report
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " install to install PennyLane"
@echo " wheel to build the PennyLane wheel"
@echo " dist to package the source distribution"
@echo " clean to delete all temporary, cache, and build files"
@echo " docs to build the PennyLane documentation"
@echo " clean-docs to delete all built documentation"
@echo " test to run the test suite"
@echo " coverage to generate a coverage report"
@echo " format [check=1] to apply black formatter; use with 'check=1' to check instead of modify (requires black)"
@echo " lint to run pylint on source files"
@echo " lint-test to run pylint on test files"
.PHONY: install
install:
ifndef PYTHON3
@echo "To install PennyLane you need to have Python 3 installed"
endif
$(PYTHON) setup.py install
.PHONY: wheel
wheel:
$(PYTHON) setup.py bdist_wheel
.PHONY: dist
dist:
$(PYTHON) setup.py sdist
.PHONY : clean
clean:
rm -rf pennylane/__pycache__
rm -rf pennylane/optimize/__pycache__
rm -rf pennylane/expectation/__pycache__
rm -rf pennylane/ops/__pycache__
rm -rf pennylane/devices/__pycache__
rm -rf tests/__pycache__
rm -rf tests/new_qnode/__pycache__
rm -rf dist
rm -rf build
rm -rf .coverage coverage_html_report/
rm -rf tmp
rm -rf *.dat
docs:
make -C doc html
.PHONY : clean-docs
clean-docs:
rm -rf doc/code/api
make -C doc clean
test:
$(PYTHON) $(TESTRUNNER)
coverage:
@echo "Generating coverage report..."
$(PYTHON) $(TESTRUNNER) $(COVERAGE)
.PHONY:format
format:
ifdef check
$(PYTHON) -m isort --py 311 --profile black -l 100 -o autoray -p ./pennylane --skip __init__.py --filter-files ./pennylane ./tests --check
$(PYTHON) -m black -t py39 -t py310 -t py311 -l 100 ./pennylane ./tests --check
else
$(PYTHON) -m isort --py 311 --profile black -l 100 -o autoray -p ./pennylane --skip __init__.py --filter-files ./pennylane ./tests
$(PYTHON) -m black -t py39 -t py310 -t py311 -l 100 ./pennylane ./tests
endif
.PHONY: lint
lint:
$(PYTHON) -m pylint pennylane --rcfile .pylintrc
.PHONY: lint-test
lint-test:
$(PYTHON) -m pylint tests pennylane/devices/tests --rcfile tests/.pylintrc