-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yaml
83 lines (71 loc) · 2.43 KB
/
Taskfile.yaml
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
# Taskfile
version: 3
tasks:
default: task --list
init-venv:
aliases: [iv]
desc: Initialize virtual environment
status:
- test -d venv
cmds:
- test -d venv && rm -rf venv || true
- python3 -m venv venv
- source venv/bin/activate && pip install -e .
- source venv/bin/activate && pip install -r requirements.txt
init-venv-build:
aliases: [ivb]
desc: Initialize build virtual environment
env:
VENV: source venv-build/bin/activate &&
status:
- test -d venv-build
cmds:
- test -d venv-build && rm -rf venv-build || true
- python3 -m venv venv-build
- source venv-build/bin/activate && python3 -m venv venv-build
- source venv-build/bin/activate && pip install --upgrade setuptools wheel build twine
- source venv-build/bin/activate && source venv/bin/activate && pip install -r requirements.txt
pre-commit:
desc: Run pre-commit
aliases:
- pc
cmds:
- task: all-examples
- task: black
- task: test
black:
desc: Run black
cmds:
- . venv/bin/activate && black src/taskcli/*.py tests/*.py examples/*.py --line-length 120
build:
desc: build package
cmds:
- test -d dist && rm -rf dist || true
- . venv-build/bin/activate && python -m build
test:
desc: Run tests
aliases: [t]
cmds:
- task: black
- . venv/bin/activate && python -m unittest discover -s tests -p "*_test.py" {{.CLI_ARGS}} -v
- . venv/bin/activate && python -m unittest discover -s examples -p "*_test.py" {{.CLI_ARGS}} -v
- . venv/bin/activate && examples/defaulttask.py | grep "Hello"
- . venv/bin/activate && examples/example1.py -a 1 -b 2
- . venv/bin/activate && examples/example1.py -h
all-examples:
desc: Run all examples
aliases: [ae]
cmds:
- . venv/bin/activate && ./examples/example1.py
- . venv/bin/activate && ./examples/example1.py hello-world -h
- . venv/bin/activate && ./examples/example1.py hello-world -hh
- . venv/bin/activate && ./examples/example1.py hello-world -n 5 -m "Hello!"
- . venv/bin/activate && ./examples/example1.py hello-world -n 1
upload-prod:
desc: Upload to PyPI
cmds:
- . venv-build/bin/activate && python -m twine upload dist/taskcli-*
upload-test:
desc: Upload to Test PyPI
cmds:
- . venv-build/bin/activate && python -m twine upload --repository testpypi dist/taskcli-*