-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaskfile.yaml
More file actions
140 lines (117 loc) · 3.82 KB
/
taskfile.yaml
File metadata and controls
140 lines (117 loc) · 3.82 KB
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
137
138
139
140
version: "3"
vars:
# could use env var
PACKAGE_NAME: "digitalkin"
PACKAGE_DIR: "src/{{.PACKAGE_NAME}}"
tasks:
venv:
desc: "Install project venv"
cmds:
- uv venv --python 3.10
install-deps:
desc: "Install project dependencies from pyproject.toml"
cmds:
- uv pip compile pyproject.toml -o requirements.txt
- |
if [ -n "$VIRTUAL_ENV" ] || [ -d ".venv" -a -f ".venv/bin/activate" ]; then
echo "Installing in virtual environment"
uv pip install -e .
else
echo "Installing in system Python"
uv pip install -e . --system
fi
dev-deps:
desc: "Install development dependencies"
cmds:
- uv sync --extra taskiq --group dev --group docs # uv pip install -e ".[taskiq]" --group dev --group docs
examples-deps:
desc: "Install examples dependencies"
cmds:
- uv sync --group examples
tests-deps:
desc: "Install tests dependencies"
cmds:
- uv sync --group tests
setup-pre-commit:
desc: "Install pre-commit hooks"
cmds:
- uv run pre-commit install
build-package:
desc: "Build the PyPI package (runs your build script)"
cmds:
- uv build
generate-certificates:
desc: "Generate certificates"
# You can customize the certificate generation with various options:
# python generate_certificates.py --output-dir ./my-certs --key-size 4096 --dns-names localhost myserver.example.com --ip-addresses 127.0.0.1 192.168.1.100
cmds:
- uv run python scripts/generate_certificates.py
publish-package-test:
desc: "Publish the package to the PyPI's test env"
cmds:
- uv publish --repository-url https://test.pypi.org/legacy/
publish-package:
desc: "Publish the package to PyPI"
cmds:
- uv publish
test-package:
desc: "Test if the PyPI package is well published"
cmds:
- task: build-package
- uv run --with {{.PACKAGE_NAME}} --no-project -- python -c 'import {{.PACKAGE_NAME}}; print({{.PACKAGE_NAME}}.__version__)'
run-tests:
desc: "Run pytest tests"
cmds:
- docker compose run --rm -T tests
linter:
desc: "run linter on the project"
cmds:
- |
uv run ruff format . && uv run ruff check --select I --fix . && uv run ruff check . --fix
- uv run mypy src/{{.PACKAGE_NAME}}
clean:
desc: "Remove build artifacts and cache directories"
cmds:
- rm -rf dist src/{{.PACKAGE_NAME}}.egg-info
- find . -type d -name "__pycache__" -exec rm -rf {} +
- find . -type d -name "*.egg-info" -exec rm -rf {} +
clean-all:
desc: "Deep clean venv and dist"
cmds:
- task: clean
# Clean up virtual environment
- rm -rf .venv
- rm -rf dist
test-publish:
desc: "push and test the package in a test env"
cmds:
- task: publish-package-test
- task: test-package
bump-version:
desc: "Bump package version (type: major, minor, patch, pre_l or pre_n)"
cmds:
- SKIP=pytest bump-my-version bump {{.CLI_ARGS}}
setup-dev:
desc: "Setup development environment"
cmds:
- task: venv
- uv sync --extra taskiq --group dev --group docs --group tests
- task: setup-pre-commit
docs-serve:
desc: "Serve documentation locally"
cmds:
- uv run mkdocs serve
docs-build:
desc: "Build documentation"
cmds:
- uv run mkdocs build
check:
desc: "Run linter, type check, and tests"
cmds:
- task: linter
- uv run mypy src/{{.PACKAGE_NAME}}
- task: run-tests
start-taskiq:
desc: "Start TaskIQ worker. be sure to enable rabbitMQ stream capability"
cmds:
- taskiq worker digitalkin.core.job_manager.taskiq_broker:TASKIQ_BROKER -w 1