-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
104 lines (86 loc) · 2.48 KB
/
Taskfile.yml
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
92
93
94
95
96
97
98
99
100
101
102
103
104
# https://github.com/go-task/task
# https://taskfile.dev
version: '3'
dotenv: ['.env', '{{.ENV}}/.env.', '{{.HOME}}/.env']
env:
PACKAGE: python_template
DOCKER_IMAGE: ${{.PACKAGE}}kj:version
vars:
VENV_DIR: "{{.HOME}}/.venv/$PACKAGE"
tasks:
dummy:
cmds:
- echo $DOCKER_IMAGE
black:
desc: run the python black formatter
cmds:
- "{{.VENV_DIR}}/bin/black src/$PACKAGE/ tests/"
checklist:
desc: run python toolkit
deps: [black, ruff]
clean:
desc: cleanup python environment and cache
deps: [venv-remove]
cmds:
- rm -rf dist/
- rm -rf build/
- rm -rf _build/
- rm -rf *.egg-info
- find . -name '*.pyc' -delete
- find . -name '*.pyo' -delete
- find . -name '*.egg-link' -delete
- find . -name '__pycache__' -type d -exec rm --recursive --force {} +
- find . -name '.mypy_cache' -type d -exec rm --recursive --force {} +
- find . -name '.pytest_cache' -type d -exec rm --recursive --force {} +
- find . -name '.ruff_cache' -type d -exec rm --recursive --force {} +
- find . -name '*.pyc' -exec rm --force {} +
- find . -name '*.pyo' -exec rm --force {} +
dbuild:
desc: docker build $DOCKER_IMAGE
cmds:
- docker build . --network host --tag $DOCKER_IMAGE
silent: false
install:
deps: [venv]
desc: pip install
cmds:
- "{{.VENV_DIR}}/bin/pip install --upgrade pip --requirement requirements-dev.txt"
silent: false
pc-install:
desc: pre-commit install
cmds:
- "{{.VENV_DIR}}/bin/pre-commit install"
# radon:
# desc: run radon
# cmds:
# - "{{.VENV_DIR}}/bin/radon cc --average -nc src/$PACKAGE/ tests/"
# #- "{{.VENV_DIR}}/bin/radon mi src/$PACKAGE/ tests/"
# silent: false
ruff:
desc: ruff linter
silent: false
cmds:
- "{{.VENV_DIR}}/bin/ruff --show-files src/$PACKAGE/ tests/"
setup:
desc: setup dev environment
deps: [install]
silent: false
cmds:
- task: pc-install
test:
desc: run tests with pytest
cmds:
- "{{.VENV_DIR}}/bin/pytest -s --verbose tests/"
venv:
desc: create python virtual environment with venv
cmds:
- python -m venv {{.VENV_DIR}}
- "{{.VENV_DIR}}/bin/python -m pip install --upgrade pip"
silent: false
status:
- test -d {{.VENV_DIR}}
venv-remove:
desc: remove python virtual environment
cmds:
- rm -rf {{.VENV_DIR}}
silent: false