forked from AllenDowney/ThinkStats2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (35 loc) · 1.55 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
#################################################################################
# GLOBALS #
#################################################################################
PROJECT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
PROJECT_NAME = ThinkStats2
PYTHON_VERSION = 3.10
PYTHON_INTERPRETER = python
#################################################################################
# COMMANDS #
#################################################################################
## Install Python Dependencies
requirements:
$(PYTHON_INTERPRETER) -m pip install -U pip setuptools wheel
$(PYTHON_INTERPRETER) -m pip install -r requirements.txt
## Delete all compiled Python files
clean:
find . -type f -name "*.py[co]" -delete
find . -type d -name "__pycache__" -delete
## Lint using flake8 and black (use `make format` to do formatting)
lint:
flake8 code
black --check --config pyproject.toml code
## Format source code with black
format:
black --config pyproject.toml code
## Set up python interpreter environment
create_environment:
conda create --name $(PROJECT_NAME) python=$(PYTHON_VERSION) -y
@echo ">>> conda env created. Activate with:\nconda activate $(PROJECT_NAME)"
tests:
cd solutions; pytest --nbmake chap*soln.ipynb
cd code; pytest --nbmake chap*ex.ipynb
cd code; python thinkstats2_test.py
# don't run thinkplot_test; it hangs on MacOS and Windows
# cd code; python thinkplot_test.py