-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
79 lines (62 loc) · 1.58 KB
/
justfile
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
# Common Flask project tasks
# Set up the virtual environment based on the direnv convention
# https://direnv.net/docs/legacy.html#virtualenv
python_version := env('PYTHON_VERSION', "3.12")
virtual_env := justfile_directory() / ".direnv/python-$python_version/bin"
export PATH := virtual_env + ":" + env('PATH')
export REQUIREMENTS_TXT := env('REQUIREMENTS', '')
[private]
prepare:
pip install --quiet --upgrade pip
[[ -f requirements/pip-tools.txt ]] && pip install -r requirements/pip-tools.txt || pip install --quiet pip-tools
# lock the requirements files
compile: prepare
pip-compile-multi --use-cache --backtracking
# Install dependencies
sync: prepare
pip-sync requirements/dev.txt
[[ -f requirements/local.txt ]] && pip install -r requirements/local.txt || true
tox -p auto --notest
alias install := sync
alias develop := sync
# Sort imports
isort:
-pre-commit run reorder-python-imports --all-files
# Run tests
test:
pytest --cov-report=html
# Run all tests
test-all:
tox -p auto
alias tox := test-all
alias t := test-all
# Run lints
lint:
pre-commit run --all-files
# Run mypy
mypy:
mypy
# run the flask application
serve:
flask run
alias s := serve
alias run := serve
# Build docs
docs:
cd docs && make html
# Clean up
clean:
rm -rf dist/* *.egg-info
rm -rf docs/_build
# Clean up docs
clean-docs:
rm -rf docs/_build
rm -rf docs/api
# Clean aggressively
clean-all: clean clean-docs
rm -rf .direnv
rm -rf .venv
rm -rf .tox
rm -rf .mypy_cache .pytest_cache
rm -rf docs/api
rm -rf .coverage htmlcov