-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
86 lines (72 loc) · 2.2 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
PYTHON3 := $(shell which python3 2>/dev/null)
TESTRUNNER := -m pytest tests -p no:warnings
COVERAGE := --cov=mrmustard --cov-report=html --cov-append
ifdef check
CHECK := --check --diff
ICHECK := --check
else
CHECK :=
ICHECK :=
endif
.PHONY: help
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " install to install Mr Mustard"
@echo " install-all to install Mr Mustard with all extras and optional dependencies"
@echo " dist to package the source distribution"
@echo " clean to delete all temporary, cache, and build files"
@echo " clean-docs to delete all built documentation"
@echo " format [check=1] to run isort and black formatting; use with 'check=1' to check instead of modify"
@echo " test to run the test suite for entire codebase"
@echo " coverage to generate a coverage report for entire codebase"
.PHONY: install
install:
ifndef PYTHON3
@echo "To install Mr Mustard you need to have Python 3 installed"
endif
poetry install
.PHONY: install-all
install-all:
ifndef PYTHON3
@echo "To install Mr Mustard you need to have Python 3 installed"
endif
poetry install --all-extras --with dev,doc
.PHONY: dist
dist:
poetry build
.PHONY : clean
clean:
rm -rf mrmustard/__pycache__
rm -rf mrmustard/lab/__pycache__
rm -rf mrmustard/lab/abstract/__pycache__
rm -rf mrmustard/math/__pycache__
rm -rf mrmustard/physics/__pycache__
rm -rf mrmustard/utils/__pycache__
rm -rf mrmustard/backends/gaussianbackend/__pycache__
rm -rf tests/__pycache__
rm -rf tests/test_lab/__pycache__
rm -rf tests/test_physics/__pycache__
rm -rf tests/test_utils/__pycache__
rm -rf dist
rm -rf build
docs:
make -C doc html
.PHONY : clean-docs
clean-docs:
make -C doc clean
rm -rf doc/code/api
.PHONY : format
format:
isort --py 312 --profile black -l 100 -p mrmustard/ tests/ $(ICHECK)
black -t py310 -t py311 -t py312 -l 100 mrmustard/ tests/ $(CHECK)
.PHONY : lint
lint:
pylint mrmustard
test:
@echo "Testing Mr Mustard..."
$(PYTHON3) $(TESTRUNNER)
coverage:
@echo "Generating coverage report for Mr Mustard..."
$(PYTHON3) $(TESTRUNNER) $(COVERAGE)
clean-coverage:
rm -rf coverage_html_report