-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
175 lines (148 loc) · 5.35 KB
/
Copy pathTaskfile.yaml
File metadata and controls
175 lines (148 loc) · 5.35 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
version: '3'
silent: true
includes:
nvidia: Taskfile.nvidia.yaml
privacy-filter: Taskfile.privacy-filter.yaml
gliner2: Taskfile.gliner2.yaml
cli: Taskfile.cli.yaml
dotenv:
- .env
vars:
PYTHON:
sh: "command -v python3.13 || command -v python3.12 || command -v python3"
VENV_DIR: .venv
REQUIREMENTS: requirements.txt
RUFF:
sh: "if command -v ruff >/dev/null 2>&1; then command -v ruff; elif test -x .venv/bin/ruff; then printf '%s\n' .venv/bin/ruff; else printf '%s\n' ruff; fi"
tasks:
# Environment ----------------------------------------------------------------
setup:
desc: Create venv and install runtime dependencies
cmds:
- task: venv
- task: install
- |
printf '%s\n' "Setup complete. Next steps:"
printf '%s\n' " task check - Run lint and tests"
printf '%s\n' " task run - Run benchmark evaluation"
printf '%s\n' " task analyze - Screen an unlabelled file (see README)"
printf '%s\n' " task privacy-filter:install / gliner2:install - Install optional engines"
venv:
desc: Create the Python virtual environment
cmds:
- "uv venv {{.VENV_DIR}} --python {{.PYTHON}}"
status:
- test -d {{.VENV_DIR}}
- test -x {{.VENV_DIR}}/bin/python3 || test -x {{.VENV_DIR}}/bin/python
install:
desc: Install runtime dependencies into the venv
deps: [venv]
cmds:
- "uv pip install --upgrade -r {{.REQUIREMENTS}} --python {{.VENV_DIR}}/bin/python"
- "uv pip install -e . --python {{.VENV_DIR}}/bin/python"
- "touch {{.VENV_DIR}}/.requirements.stamp"
status:
- test -f {{.VENV_DIR}}/.requirements.stamp
- test {{.VENV_DIR}}/.requirements.stamp -nt {{.REQUIREMENTS}}
- test {{.VENV_DIR}}/.requirements.stamp -nt pyproject.toml
dev-install:
desc: Install development dependencies (pytest)
deps: [install]
cmds:
- "uv pip install -e '.[dev]' --python {{.VENV_DIR}}/bin/python"
update:
desc: Upgrade runtime dependencies to latest versions
deps: [venv]
cmds:
- "uv pip install --upgrade -r {{.REQUIREMENTS}} --python {{.VENV_DIR}}/bin/python"
- "uv pip install -e . --python {{.VENV_DIR}}/bin/python"
- "touch {{.VENV_DIR}}/.requirements.stamp"
clean:
desc: Remove the virtual environment and build artefacts
cmds:
- |
rm -rf {{.VENV_DIR}}
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
rm -rf *.egg-info build dist .cache .pytest_cache .ruff_cache
cache-clear:
desc: Clear the PII analysis disk cache
cmds:
- "rm -rf .cache/pii-eval"
# Quality --------------------------------------------------------------------
check:
desc: Run lint and tests
deps: [install]
cmds:
- task: lint
- task: test
lint:
desc: Run ruff lint and format check
deps: [install]
cmds:
- |
printf '%s\n' "Running ruff linter..."
{{.RUFF}} check evaluation/ examples/ tests/
printf '%s\n' "Running ruff format check..."
{{.RUFF}} format --check evaluation/ examples/ tests/
format:
desc: Format code with ruff
deps: [install]
cmds:
- |
printf '%s\n' "Formatting with ruff..."
{{.RUFF}} format evaluation/ examples/ tests/
{{.RUFF}} check --fix evaluation/ examples/ tests/
test:
desc: Run the pytest suite
deps: [dev-install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python python -m pytest tests/ -v"
# Evaluation CLI -------------------------------------------------------------
run:
desc: Run benchmark evaluation on labelled JSONL samples
deps: [install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python pii-eval run"
compare:
desc: Compare engines on labelled JSONL samples
deps: [install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python pii-eval compare {{.CLI_ARGS}}"
sweep:
desc: Sweep an engine across score thresholds
deps: [install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python pii-eval sweep"
analyze:
desc: Screen one unlabelled file for PII findings
deps: [install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python pii-eval analyze {{.CLI_ARGS}}"
analyze-compare:
desc: Compare engines on one unlabelled file
deps: [install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python pii-eval analyze-compare {{.CLI_ARGS}}"
analyze-batch:
desc: Screen all supported files in a directory
deps: [install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python pii-eval analyze-batch {{.CLI_ARGS}}"
annotations-to-jsonl:
desc: Convert reviewed annotations into benchmark JSONL
deps: [install]
cmds:
- "uv run --python {{.VENV_DIR}}/bin/python pii-eval annotations-to-jsonl {{.CLI_ARGS}}"
# Developer tooling ----------------------------------------------------------
codex-review:
desc: Run Codex code review on the codebase (if codex is installed)
deps: [install]
cmds:
- |
if command -v codex >/dev/null 2>&1; then
printf '%s\n' "Running Codex code review..."
codex --sandbox read-only exec "Review this Python project for potential issues and improvements."
else
printf '%s\n' "Codex CLI not found; skipping codex-review task."
fi