-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathTaskfile.yaml
136 lines (115 loc) · 3.27 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
version: 3
includes:
test:
taskfile: ./tests/Taskfile.yaml
mig:
taskfile: ./migrations/Taskfile.yaml
vars:
RUNNER: "uv run"
dotenv:
- ".env"
tasks:
install:local:
desc: "Install all dependencies (for local development)."
cmds:
- 'uv sync --group local --frozen {{.CLI_ARGS}}'
install:local_fresh:
desc: "Install all dependencies (for local development)."
cmds:
- 'uv sync --group local --reinstall --frozen {{.CLI_ARGS}}'
install:dev:
desc: "Install all dependencies (for development)."
cmds:
- 'uv sync --no-group local --group test --group linters --frozen {{.CLI_ARGS}}'
install:
desc: "Install all dependencies (for production)."
cmds:
- 'uv sync {{.CLI_ARGS}}'
tree:
desc: "Show the tree of installed dependencies."
cmds:
- 'uv tree --depth 2 --color always {{.CLI_ARGS}}'
lint:
desc: "Run linters, not change code."
vars:
ABSOLUTE: "A"
MODULES: "A"
AVERAGE: "A"
EXCLUDE: "tests*"
cmds:
- '{{.RUNNER}} xenon . -b {{.ABSOLUTE}} -m {{.MODULES}} -a {{.AVERAGE}} -e "{{.EXCLUDE}}"'
- "{{.RUNNER}} ruff check ."
ignore_error: true
lint:docs:
desc: "Run coverage for documentation."
summary: |
Default usage: `task lint:docs`.
Extended usage: `task lint:docs -- v` (Increasing verbosity level to `-vv`, `-v` by default)."
cmd: "{{.RUNNER}} interrogate {{.VERBOSITY}}{{.CLI_ARGS}}"
vars:
VERBOSITY: "-v"
lint:types:
desc: "Run mypy (type annotations linter)."
cmd: "{{.RUNNER}} mypy ."
lint:plus:
desc: "Run all linters and ignore errors."
cmds:
- task: lint
- task: lint:docs
- task: lint:types
ignore_error: true
format:
desc: "Run formatters and auto fixing errors."
cmds:
- "{{.RUNNER}} ruff format"
- "{{.RUNNER}} ruff check . --fix"
pre:
desc: "Run `format` then `lint`."
cmds:
- task: format
- task: lint
- task: test:cov
run:gunicorn:
desc: "Start web server via `Gunicorn` (production mode)."
cmd: "{{.RUNNER}} gunicorn {{.APP_MODULE_PATH}} -c gunicorn.conf.py"
run:granian:
desc: "Start web server via `Granian` (development mode)."
cmd: >
{{.RUNNER}} granian --interface asgi {{.APP_MODULE_PATH}}
--host {{.SERVER_HOST}}
--port {{.SERVER_PORT}}
--log
--access-log
--reload
--reload-paths src/
--reload-paths .env
{{.CLI_ARGS}}
run:uvicorn:
desc: "Start web server via `Uvicorn` (development mode)."
cmd: >
{{.RUNNER}} uvicorn {{.APP_MODULE_PATH}}
--host {{.SERVER_HOST}}
--port {{.SERVER_PORT}}
--reload
--reload-dir "src"
--reload-include ".env"
{{.CLI_ARGS}}
run:fastapi:
desc: "Start web server via 'FastAPI' CLI (development mode)"
cmd: >
{{.RUNNER}} fastapi dev src/api/__main__.py --app app
--host {{.SERVER_HOST}}
--port {{.SERVER_PORT}}
--reload
--root-path ./
{{.CLI_ARGS}}
run:
desc: "Run migrations and then start web."
cmds:
- task: mig:head
- task: run:granian
req:
desc: "Generate main `requirements.txt` file from Poetry."
vars:
format: "requirements.txt"
cmd: "uv pip compile pyproject.toml -o {{.format}}"