tasktree 0.0.7__py3-none-any.whl → 0.0.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tasktree/cli.py +78 -22
- tasktree/docker.py +25 -0
- tasktree/executor.py +346 -34
- tasktree/graph.py +124 -26
- tasktree/hasher.py +73 -2
- tasktree/parser.py +1288 -35
- tasktree/substitution.py +198 -0
- tasktree/types.py +11 -2
- tasktree-0.0.9.dist-info/METADATA +1240 -0
- tasktree-0.0.9.dist-info/RECORD +15 -0
- tasktree-0.0.7.dist-info/METADATA +0 -654
- tasktree-0.0.7.dist-info/RECORD +0 -14
- {tasktree-0.0.7.dist-info → tasktree-0.0.9.dist-info}/WHEEL +0 -0
- {tasktree-0.0.7.dist-info → tasktree-0.0.9.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
tasktree/__init__.py,sha256=MVmdvKb3JdqLlo0x2_TPGMfgFC0HsDnP79HAzGnFnjI,1081
|
|
2
|
+
tasktree/cli.py,sha256=H5T8wOxLBGx-ZTQEnkoJrX3srgD5b_7BLf1IWl18M2M,17597
|
|
3
|
+
tasktree/docker.py,sha256=R69NcZw4MyaxEXyJAwniYCm877iaI10jRhxlLmkA6Fs,14119
|
|
4
|
+
tasktree/executor.py,sha256=Q7Bks5B88i-IyZDpxGSps9MM3uflz0U3yn4Rtq_uHMM,42266
|
|
5
|
+
tasktree/graph.py,sha256=oXLxX0Ix4zSkVBg8_3x9K7WxSFpg136sp4MF-d2mDEQ,9682
|
|
6
|
+
tasktree/hasher.py,sha256=C8oN-K6dtL3vLHSPhKR7uu5c1d4vplGSAMZUq5M4scw,4125
|
|
7
|
+
tasktree/parser.py,sha256=DjdfsKErdBggqS8Tw_mwuMvMSavIJqq2BCdsh1O82CY,66333
|
|
8
|
+
tasktree/state.py,sha256=Cktl4D8iDZVd55aO2LqVyPrc-BnljkesxxkcMcdcfOY,3541
|
|
9
|
+
tasktree/substitution.py,sha256=M_qcP0NKJATrKcNShSqHJatneuth1RVwTk1ci8-ZuxQ,6473
|
|
10
|
+
tasktree/tasks.py,sha256=2QdQZtJAX2rSGbyXKG1z9VF_siz1DUzdvzCgPkykxtU,173
|
|
11
|
+
tasktree/types.py,sha256=R_YAyO5bMLB6XZnkMRT7VAtlkA_Xx6xu0aIpzQjrBXs,4357
|
|
12
|
+
tasktree-0.0.9.dist-info/METADATA,sha256=VBgQ1ZF2hacw1CajhxcjkrGTyygnf-uWxiZm7H92AyE,37123
|
|
13
|
+
tasktree-0.0.9.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
tasktree-0.0.9.dist-info/entry_points.txt,sha256=lQINlvRYnimvteBbnhH84A9clTg8NnpEjCWqWkqg8KE,40
|
|
15
|
+
tasktree-0.0.9.dist-info/RECORD,,
|
|
@@ -1,654 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: tasktree
|
|
3
|
-
Version: 0.0.7
|
|
4
|
-
Summary: A task automation tool with incremental execution
|
|
5
|
-
Requires-Python: >=3.11
|
|
6
|
-
Requires-Dist: click>=8.1.0
|
|
7
|
-
Requires-Dist: colorama>=0.4.6
|
|
8
|
-
Requires-Dist: pathspec>=0.11.0
|
|
9
|
-
Requires-Dist: pyyaml>=6.0
|
|
10
|
-
Requires-Dist: rich>=13.0.0
|
|
11
|
-
Requires-Dist: typer>=0.9.0
|
|
12
|
-
Provides-Extra: dev
|
|
13
|
-
Requires-Dist: pytest>=9.0.2; extra == 'dev'
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
|
|
16
|
-
# Task Tree (tt)
|
|
17
|
-
|
|
18
|
-
[](https://github.com/kevinchannon/task-tree/actions/workflows/test.yml)
|
|
19
|
-
|
|
20
|
-
A task automation tool that combines simple command execution with dependency tracking and incremental execution.
|
|
21
|
-
|
|
22
|
-
## Motivation
|
|
23
|
-
In any project of even moderate size, various scripts inevitably come into being along the way. These scripts often must be run in a particular order, or at a particular time. For historical reasons, this almost certainly a problem if your project is developed in a Linux environment; in Windows, an IDE like Visual Studio may be taking care of a significant proportion of your build, packaging and deployment tasks. Then again, it may not...
|
|
24
|
-
|
|
25
|
-
The various incantations that have to be issued to build, package, test and deploy a project can build up and then all of a sudden there's only a few people that remember which to invoke and when and then people start making helpful readme guides on what to do with the scripts and then those become out of date and start telling lies about things and so on.
|
|
26
|
-
|
|
27
|
-
Then there's the scripts themselves. In Linux, they're probably a big pile of Bash and Python, or something (Ruby, Perl, you name it). You can bet the house on people solving the problem of passing parameters to their scripts in a whole bunch of different and inconsistent ways.
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
#!/usr/bin/env bash
|
|
31
|
-
# It's an environment variable defined.... somewhere?
|
|
32
|
-
echo "FOO is: $FOO"
|
|
33
|
-
```
|
|
34
|
-
```bash
|
|
35
|
-
#!/usr/bin/env bash
|
|
36
|
-
# Using simple positional arguments... guess what means what when you're invoking it!
|
|
37
|
-
echo "First: $1, Second: $2"
|
|
38
|
-
```
|
|
39
|
-
```bash
|
|
40
|
-
#!/usr/bin/env bash
|
|
41
|
-
# Oooooh fancy "make me look like a proper app" named option parsing... don't try and do --foo=bar though!
|
|
42
|
-
FOO=""
|
|
43
|
-
while [[ $# -gt 0 ]]; do
|
|
44
|
-
case "$1" in
|
|
45
|
-
--foo) FOO=$2; shift ;;
|
|
46
|
-
--) break ;;
|
|
47
|
-
*) echo "Unknown: $1";;
|
|
48
|
-
esac
|
|
49
|
-
shift
|
|
50
|
-
done
|
|
51
|
-
```
|
|
52
|
-
```bash
|
|
53
|
-
#!/usr/bin/env bash
|
|
54
|
-
# This thing...
|
|
55
|
-
ARGS=$(getopt -o f:b --long foo:,bar: -n 'myscript' -- "$@")
|
|
56
|
-
eval set -- "$ARGS"
|
|
57
|
-
while true; do
|
|
58
|
-
case "$1" in
|
|
59
|
-
-b|--bar) echo "Bar: $2"; shift 2 ;;
|
|
60
|
-
-f|--foo) echo "Foo: $2"; shift 2 ;;
|
|
61
|
-
--) shift; break ;;
|
|
62
|
-
*) break ;;
|
|
63
|
-
esac
|
|
64
|
-
done
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
What about help info? Who has time to wire that in?
|
|
68
|
-
|
|
69
|
-
### The point
|
|
70
|
-
Is this just whining and moaning? Should we just man up and revel in our own ability to memorize all the right incantations like some kind of scripting shaman?
|
|
71
|
-
|
|
72
|
-
... No. That's **a dumb idea**.
|
|
73
|
-
|
|
74
|
-
Task Tree allows you to pile all the knowledge of **what** to run, **when** to run it, **where** to run it and **how** to run it into a single, readable place. Then you can delete all the scripts that no-one knows how to use and all the readme docs that lie to the few people that actually waste their time reading them.
|
|
75
|
-
|
|
76
|
-
The tasks you need to perform to deliver your project become summarised in an executable file that looks like:
|
|
77
|
-
```yaml
|
|
78
|
-
tasks:
|
|
79
|
-
build:
|
|
80
|
-
desc: Compile stuff
|
|
81
|
-
outputs: [target/release/bin]
|
|
82
|
-
cmd: cargo build --release
|
|
83
|
-
|
|
84
|
-
package:
|
|
85
|
-
desc: build installers
|
|
86
|
-
deps: [build]
|
|
87
|
-
outputs: [awesome.deb]
|
|
88
|
-
cmd: |
|
|
89
|
-
for bin in target/release/*; do
|
|
90
|
-
if [[ -x "$bin" && ! -d "$bin" ]]; then
|
|
91
|
-
install -Dm755 "$bin" "debian/awesome/usr/bin/$(basename "$bin")"
|
|
92
|
-
fi
|
|
93
|
-
done
|
|
94
|
-
|
|
95
|
-
dpkg-buildpackage -us -uc
|
|
96
|
-
|
|
97
|
-
test:
|
|
98
|
-
desc: Run tests
|
|
99
|
-
deps: [package]
|
|
100
|
-
inputs: [tests/**/*.py]
|
|
101
|
-
cmd: PYTHONPATH=src python3 -m pytest tests/ -v
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
If you want to run the tests then:
|
|
105
|
-
```bash
|
|
106
|
-
tt test
|
|
107
|
-
```
|
|
108
|
-
Boom! Done. `build` will always run, because there's no sensible way to know what Cargo did. However, if Cargo decided that nothing needed to be done and didn't touch the binaries, then `package` will realize that and not do anything. Then `test` will just run with the new tests that you just wrote. If you then immediately run `test` again, then `test` will figure out that none of the dependencies did anything and that none of the test files have changed and then just _do nothing_ - as it should.
|
|
109
|
-
|
|
110
|
-
This is a toy example, but you can image how it plays out on a more complex project.
|
|
111
|
-
|
|
112
|
-
## Installation
|
|
113
|
-
|
|
114
|
-
### From PyPI (Recommended)
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
pipx install tasktree
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
If you have multiple Python interpreter versions installed, and the _default_ interpreter is a version <3.11, then you can use `pipx`'s `--python` option to specify an interpreter with a version >=3.11:
|
|
121
|
-
|
|
122
|
-
```bash
|
|
123
|
-
# If the target version is on the PATH
|
|
124
|
-
pipx install --python python3.12 tasktree
|
|
125
|
-
|
|
126
|
-
# With a path to an interpreter
|
|
127
|
-
pipx install --python /path/to/python3.12 tasktree
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### From Source
|
|
131
|
-
|
|
132
|
-
For the latest unreleased version from GitHub:
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
pipx install git+https://github.com/kevinchannon/task-tree.git
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Or to install from a local clone:
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
git clone https://github.com/kevinchannon/task-tree.git
|
|
142
|
-
cd tasktree
|
|
143
|
-
pipx install .
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## Editor Support
|
|
147
|
-
|
|
148
|
-
Task Tree includes a [JSON Schema](schema/tasktree-schema.json) that provides autocomplete, validation, and documentation in modern editors.
|
|
149
|
-
|
|
150
|
-
### VS Code
|
|
151
|
-
|
|
152
|
-
Install the [YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml), then add to your workspace `.vscode/settings.json`:
|
|
153
|
-
|
|
154
|
-
```json
|
|
155
|
-
{
|
|
156
|
-
"yaml.schemas": {
|
|
157
|
-
"https://raw.githubusercontent.com/kevinchannon/tasktree/main/schema/tasktree-schema.json": [
|
|
158
|
-
"tasktree.yaml",
|
|
159
|
-
"tt.yaml"
|
|
160
|
-
]
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Or add a comment at the top of your `tasktree.yaml`:
|
|
166
|
-
|
|
167
|
-
```yaml
|
|
168
|
-
# yaml-language-server: $schema=https://raw.githubusercontent.com/kevinchannon/tasktree/main/schema/tasktree-schema.json
|
|
169
|
-
|
|
170
|
-
tasks:
|
|
171
|
-
build:
|
|
172
|
-
cmd: cargo build
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
See [schema/README.md](schema/README.md) for IntelliJ/PyCharm and command-line validation.
|
|
176
|
-
|
|
177
|
-
## Quick Start
|
|
178
|
-
|
|
179
|
-
Create a `tasktree.yaml` (or `tt.yaml`) in your project:
|
|
180
|
-
|
|
181
|
-
```yaml
|
|
182
|
-
tasks:
|
|
183
|
-
build:
|
|
184
|
-
desc: Compile the application
|
|
185
|
-
outputs: [target/release/bin]
|
|
186
|
-
cmd: cargo build --release
|
|
187
|
-
|
|
188
|
-
test:
|
|
189
|
-
desc: Run tests
|
|
190
|
-
deps: [build]
|
|
191
|
-
cmd: cargo test
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Run tasks:
|
|
195
|
-
|
|
196
|
-
```bash
|
|
197
|
-
tt # Print the help
|
|
198
|
-
tt --help # ...also print the help
|
|
199
|
-
tt --list # Show all available tasks
|
|
200
|
-
tt build # Build the application (assuming this is in your tasktree.yaml)
|
|
201
|
-
tt test # Run tests (builds first if needed)
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Core Concepts
|
|
205
|
-
|
|
206
|
-
### Intelligent Incremental Execution
|
|
207
|
-
|
|
208
|
-
Task Tree only runs tasks when necessary. A task executes if:
|
|
209
|
-
|
|
210
|
-
- Its definition (command, outputs, working directory, environment) has changed
|
|
211
|
-
- Any input files have changed since the last run
|
|
212
|
-
- Any dependencies have re-run
|
|
213
|
-
- It has never been executed before
|
|
214
|
-
- It has no inputs or outputs (always runs)
|
|
215
|
-
- The execution environment has changed (CLI override or environment config change)
|
|
216
|
-
|
|
217
|
-
### Automatic Input Inheritance
|
|
218
|
-
|
|
219
|
-
Tasks automatically inherit inputs from dependencies, eliminating redundant declarations:
|
|
220
|
-
|
|
221
|
-
```yaml
|
|
222
|
-
tasks:
|
|
223
|
-
build:
|
|
224
|
-
outputs: [dist/app]
|
|
225
|
-
cmd: go build -o dist/app
|
|
226
|
-
|
|
227
|
-
package:
|
|
228
|
-
deps: [build]
|
|
229
|
-
outputs: [dist/app.tar.gz]
|
|
230
|
-
cmd: tar czf dist/app.tar.gz dist/app
|
|
231
|
-
# Automatically tracks dist/app as an input
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Single State File
|
|
235
|
-
|
|
236
|
-
All state lives in `.tasktree-state` at your project root. Stale entries are automatically pruned—no manual cleanup needed.
|
|
237
|
-
|
|
238
|
-
## Task Definition
|
|
239
|
-
|
|
240
|
-
### Basic Structure
|
|
241
|
-
|
|
242
|
-
```yaml
|
|
243
|
-
tasks:
|
|
244
|
-
task-name:
|
|
245
|
-
desc: Human-readable description (optional)
|
|
246
|
-
deps: [other-task] # Task dependencies
|
|
247
|
-
inputs: [src/**/*.go] # Explicit input files (glob patterns)
|
|
248
|
-
outputs: [dist/binary] # Output files (glob patterns)
|
|
249
|
-
working_dir: subproject/ # Execution directory (default: project root)
|
|
250
|
-
env: bash-strict # Execution environment (optional)
|
|
251
|
-
args: [param1, param2:path=default] # Task parameters
|
|
252
|
-
cmd: go build -o dist/binary # Command to execute
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Commands
|
|
256
|
-
|
|
257
|
-
**Single-line commands** are executed directly via the configured shell:
|
|
258
|
-
|
|
259
|
-
```yaml
|
|
260
|
-
tasks:
|
|
261
|
-
build:
|
|
262
|
-
cmd: cargo build --release
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
**Multi-line commands** are written to temporary script files for proper execution:
|
|
266
|
-
|
|
267
|
-
```yaml
|
|
268
|
-
tasks:
|
|
269
|
-
deploy:
|
|
270
|
-
cmd: |
|
|
271
|
-
mkdir -p dist
|
|
272
|
-
cp build/* dist/
|
|
273
|
-
rsync -av dist/ server:/opt/app/
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
Multi-line commands preserve shell syntax (line continuations, heredocs, etc.) and support shebangs on Unix/macOS.
|
|
277
|
-
|
|
278
|
-
Or use folded blocks for long single-line commands:
|
|
279
|
-
|
|
280
|
-
```yaml
|
|
281
|
-
tasks:
|
|
282
|
-
compile:
|
|
283
|
-
cmd: >
|
|
284
|
-
gcc -o bin/app
|
|
285
|
-
src/*.c
|
|
286
|
-
-I include
|
|
287
|
-
-L lib -lm
|
|
288
|
-
```
|
|
289
|
-
|
|
290
|
-
### Execution Environments
|
|
291
|
-
|
|
292
|
-
Configure custom shell environments for task execution:
|
|
293
|
-
|
|
294
|
-
```yaml
|
|
295
|
-
environments:
|
|
296
|
-
default: bash-strict
|
|
297
|
-
|
|
298
|
-
bash-strict:
|
|
299
|
-
shell: bash
|
|
300
|
-
args: ['-c'] # For single-line: bash -c "command"
|
|
301
|
-
preamble: | # For multi-line: prepended to script
|
|
302
|
-
set -euo pipefail
|
|
303
|
-
|
|
304
|
-
python:
|
|
305
|
-
shell: python
|
|
306
|
-
args: ['-c']
|
|
307
|
-
|
|
308
|
-
powershell:
|
|
309
|
-
shell: powershell
|
|
310
|
-
args: ['-ExecutionPolicy', 'Bypass', '-Command']
|
|
311
|
-
preamble: |
|
|
312
|
-
$ErrorActionPreference = 'Stop'
|
|
313
|
-
|
|
314
|
-
tasks:
|
|
315
|
-
build:
|
|
316
|
-
# Uses 'default' environment (bash-strict)
|
|
317
|
-
cmd: cargo build --release
|
|
318
|
-
|
|
319
|
-
analyze:
|
|
320
|
-
env: python
|
|
321
|
-
cmd: |
|
|
322
|
-
import sys
|
|
323
|
-
print(f"Analyzing with Python {sys.version}")
|
|
324
|
-
# ... analysis code ...
|
|
325
|
-
|
|
326
|
-
windows-task:
|
|
327
|
-
env: powershell
|
|
328
|
-
cmd: |
|
|
329
|
-
Compress-Archive -Path dist/* -DestinationPath package.zip
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
**Environment resolution priority:**
|
|
333
|
-
1. CLI override: `tt --env python build`
|
|
334
|
-
2. Task's `env` field
|
|
335
|
-
3. Recipe's `default` environment
|
|
336
|
-
4. Platform default (bash on Unix, cmd on Windows)
|
|
337
|
-
|
|
338
|
-
**Platform defaults** when no environments are configured:
|
|
339
|
-
- **Unix/macOS**: bash with `-c` args
|
|
340
|
-
- **Windows**: cmd with `/c` args
|
|
341
|
-
|
|
342
|
-
### Parameterised Tasks
|
|
343
|
-
|
|
344
|
-
Tasks can accept arguments with optional defaults:
|
|
345
|
-
|
|
346
|
-
```yaml
|
|
347
|
-
tasks:
|
|
348
|
-
deploy:
|
|
349
|
-
args: [environment, region=eu-west-1]
|
|
350
|
-
deps: [build]
|
|
351
|
-
cmd: |
|
|
352
|
-
aws s3 cp dist/app.zip s3://{{environment}}-{{region}}/
|
|
353
|
-
aws lambda update-function-code --function-name app-{{environment}}
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
Invoke with: `tt deploy production` or `tt deploy staging us-east-1` or `tt deploy staging region=us-east-1`.
|
|
357
|
-
|
|
358
|
-
Arguments may be typed, or not and have a default, or not. Valid argument types are:
|
|
359
|
-
|
|
360
|
-
* int - an integer value (e.g. 0, 10, 123, -9)
|
|
361
|
-
* float - a floating point value (e.g. 1.234, -3.1415, 2e-4)
|
|
362
|
-
* bool - Boolean-ish value (e.g. true, false, yes, no, 1, 0, etc)
|
|
363
|
-
* str - a string
|
|
364
|
-
* path - a pathlike string
|
|
365
|
-
* datetime - a datetime in the format 2025-12-17T16:56:12
|
|
366
|
-
* ip - an ip address (v4 or v6)
|
|
367
|
-
* ipv4 - an IPv4 value
|
|
368
|
-
* ipv6 - an IPv6 value
|
|
369
|
-
* email - String validated, but not positively confirmed to be a reachable address.
|
|
370
|
-
* hostname - looks like a hostname, resolution of the name is not attempted as part of the validation
|
|
371
|
-
|
|
372
|
-
Different argument values are tracked separately—tasks re-run when invoked with new arguments.
|
|
373
|
-
|
|
374
|
-
## File Imports
|
|
375
|
-
|
|
376
|
-
Split task definitions across multiple files for better organisation:
|
|
377
|
-
|
|
378
|
-
```yaml
|
|
379
|
-
# tasktree.yaml
|
|
380
|
-
imports:
|
|
381
|
-
- file: build/tasks.yml
|
|
382
|
-
as: build
|
|
383
|
-
- file: deploy/tasks.yml
|
|
384
|
-
as: deploy
|
|
385
|
-
|
|
386
|
-
tasks:
|
|
387
|
-
test:
|
|
388
|
-
deps: [build.compile, build.test-compile]
|
|
389
|
-
cmd: ./run-tests.sh
|
|
390
|
-
|
|
391
|
-
ci:
|
|
392
|
-
deps: [build.all, test, deploy.staging]
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
Imported tasks are namespaced and can be referenced as dependencies. Each imported file is self-contained—it cannot depend on tasks in the importing file.
|
|
396
|
-
|
|
397
|
-
## Glob Patterns
|
|
398
|
-
|
|
399
|
-
Input and output patterns support standard glob syntax:
|
|
400
|
-
|
|
401
|
-
- `src/*.rs` — All Rust files in `src/`
|
|
402
|
-
- `src/**/*.rs` — All Rust files recursively
|
|
403
|
-
- `{file1,file2}` — Specific files
|
|
404
|
-
- `**/*.{js,ts}` — Multiple extensions recursively
|
|
405
|
-
|
|
406
|
-
## State Management
|
|
407
|
-
|
|
408
|
-
### How State Works
|
|
409
|
-
|
|
410
|
-
Each task is identified by a hash of its definition. The hash includes:
|
|
411
|
-
|
|
412
|
-
- Command to execute
|
|
413
|
-
- Output patterns
|
|
414
|
-
- Working directory
|
|
415
|
-
- Argument definitions
|
|
416
|
-
- Execution environment
|
|
417
|
-
|
|
418
|
-
State tracks:
|
|
419
|
-
- When the task last ran
|
|
420
|
-
- Timestamps of input files at that time
|
|
421
|
-
|
|
422
|
-
Tasks are re-run when their definition changes, inputs are newer than the last run, or the environment changes.
|
|
423
|
-
|
|
424
|
-
### What's Not In The Hash
|
|
425
|
-
|
|
426
|
-
Changes to these don't invalidate cached state:
|
|
427
|
-
|
|
428
|
-
- Task name (tasks can be renamed freely)
|
|
429
|
-
- Description
|
|
430
|
-
- Dependencies (only affects execution order)
|
|
431
|
-
- Explicit inputs (tracked by timestamp, not definition)
|
|
432
|
-
|
|
433
|
-
### Automatic Cleanup
|
|
434
|
-
|
|
435
|
-
At the start of each invocation, state is checked for invalid task hashes and non-existent ones are automatically removed. Delete a task from your recipe file and its state disappears the next time you run `tt <cmd>`
|
|
436
|
-
|
|
437
|
-
## Command-Line Options
|
|
438
|
-
|
|
439
|
-
Task Tree provides several command-line options for controlling task execution:
|
|
440
|
-
|
|
441
|
-
### Execution Control
|
|
442
|
-
|
|
443
|
-
```bash
|
|
444
|
-
# Force re-run (ignore freshness checks)
|
|
445
|
-
tt --force build
|
|
446
|
-
tt -f build
|
|
447
|
-
|
|
448
|
-
# Run only the specified task, skip dependencies (implies --force)
|
|
449
|
-
tt --only deploy
|
|
450
|
-
tt -o deploy
|
|
451
|
-
|
|
452
|
-
# Override environment for all tasks
|
|
453
|
-
tt --env python analyze
|
|
454
|
-
tt -e powershell build
|
|
455
|
-
```
|
|
456
|
-
|
|
457
|
-
### Information Commands
|
|
458
|
-
|
|
459
|
-
```bash
|
|
460
|
-
# List all available tasks
|
|
461
|
-
tt --list
|
|
462
|
-
tt -l
|
|
463
|
-
|
|
464
|
-
# Show detailed task definition
|
|
465
|
-
tt --show build
|
|
466
|
-
|
|
467
|
-
# Show dependency tree (without execution)
|
|
468
|
-
tt --tree deploy
|
|
469
|
-
|
|
470
|
-
# Show version
|
|
471
|
-
tt --version
|
|
472
|
-
tt -v
|
|
473
|
-
|
|
474
|
-
# Create a blank recipe file
|
|
475
|
-
tt --init
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
### State Management
|
|
479
|
-
|
|
480
|
-
```bash
|
|
481
|
-
# Remove state file (reset task cache)
|
|
482
|
-
tt --clean
|
|
483
|
-
tt --clean-state
|
|
484
|
-
tt --reset
|
|
485
|
-
```
|
|
486
|
-
|
|
487
|
-
### Common Workflows
|
|
488
|
-
|
|
489
|
-
```bash
|
|
490
|
-
# Fresh build of everything
|
|
491
|
-
tt --force build
|
|
492
|
-
|
|
493
|
-
# Run a task without rebuilding dependencies
|
|
494
|
-
tt --only test
|
|
495
|
-
|
|
496
|
-
# Test with a different shell/environment
|
|
497
|
-
tt --env python test
|
|
498
|
-
|
|
499
|
-
# Force rebuild and deploy
|
|
500
|
-
tt --force deploy production
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
## Example: Full Build Pipeline
|
|
504
|
-
|
|
505
|
-
```yaml
|
|
506
|
-
imports:
|
|
507
|
-
- file: common/docker.yml
|
|
508
|
-
as: docker
|
|
509
|
-
|
|
510
|
-
tasks:
|
|
511
|
-
compile:
|
|
512
|
-
desc: Build application binaries
|
|
513
|
-
outputs: [target/release/app]
|
|
514
|
-
cmd: cargo build --release
|
|
515
|
-
|
|
516
|
-
test-unit:
|
|
517
|
-
desc: Run unit tests
|
|
518
|
-
deps: [compile]
|
|
519
|
-
cmd: cargo test
|
|
520
|
-
|
|
521
|
-
package:
|
|
522
|
-
desc: Create distribution archive
|
|
523
|
-
deps: [compile]
|
|
524
|
-
outputs: [dist/app-{{version}}.tar.gz]
|
|
525
|
-
args: [version]
|
|
526
|
-
cmd: |
|
|
527
|
-
mkdir -p dist
|
|
528
|
-
tar czf dist/app-{{version}}.tar.gz \
|
|
529
|
-
target/release/app \
|
|
530
|
-
config/ \
|
|
531
|
-
migrations/
|
|
532
|
-
|
|
533
|
-
deploy:
|
|
534
|
-
desc: Deploy to environment
|
|
535
|
-
deps: [package, docker.build-runtime]
|
|
536
|
-
args: [environment, version]
|
|
537
|
-
cmd: |
|
|
538
|
-
scp dist/app-{{version}}.tar.gz {{environment}}:/opt/
|
|
539
|
-
ssh {{environment}} /opt/deploy.sh {{version}}
|
|
540
|
-
|
|
541
|
-
integration-test:
|
|
542
|
-
desc: Run integration tests against deployed environment
|
|
543
|
-
deps: [deploy]
|
|
544
|
-
args: [environment, version]
|
|
545
|
-
cmd: pytest tests/integration/ --env={{environment}}
|
|
546
|
-
```
|
|
547
|
-
|
|
548
|
-
Run the full pipeline:
|
|
549
|
-
|
|
550
|
-
```bash
|
|
551
|
-
tt integration-test staging version=1.2.3
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
This will:
|
|
555
|
-
1. Compile if sources have changed
|
|
556
|
-
2. Run unit tests if compilation ran
|
|
557
|
-
3. Package if compilation ran or version argument is new
|
|
558
|
-
4. Build Docker runtime (from imported file) if needed
|
|
559
|
-
5. Deploy if package or Docker image changed
|
|
560
|
-
6. Run integration tests (always runs)
|
|
561
|
-
|
|
562
|
-
## Implementation Notes
|
|
563
|
-
|
|
564
|
-
Built with Python 3.11+ using:
|
|
565
|
-
|
|
566
|
-
- **PyYAML** for recipe parsing
|
|
567
|
-
- **Typer**, **Click**, **Rich** for CLI
|
|
568
|
-
- **graphlib.TopologicalSorter** for dependency resolution
|
|
569
|
-
- **pathlib** for file operations and glob expansion
|
|
570
|
-
|
|
571
|
-
State file uses JSON format for simplicity and standard library compatibility.
|
|
572
|
-
|
|
573
|
-
## Development
|
|
574
|
-
|
|
575
|
-
### Setup Development Environment
|
|
576
|
-
|
|
577
|
-
```bash
|
|
578
|
-
# Clone repository
|
|
579
|
-
git clone https://github.com/kevinchannon/task-tree.git
|
|
580
|
-
cd tasktree
|
|
581
|
-
|
|
582
|
-
# Install uv (if not already installed)
|
|
583
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
584
|
-
|
|
585
|
-
# Install dependencies
|
|
586
|
-
uv sync
|
|
587
|
-
|
|
588
|
-
# Install in editable mode
|
|
589
|
-
pipx install -e .
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
### Running Tests
|
|
593
|
-
|
|
594
|
-
```bash
|
|
595
|
-
# Run all tests
|
|
596
|
-
uv run pytest
|
|
597
|
-
|
|
598
|
-
# Run with verbose output
|
|
599
|
-
uv run pytest -v
|
|
600
|
-
|
|
601
|
-
# Run specific test file
|
|
602
|
-
uv run pytest tests/unit/test_executor.py
|
|
603
|
-
```
|
|
604
|
-
|
|
605
|
-
### Using Task Tree for Development
|
|
606
|
-
|
|
607
|
-
The repository includes a `tasktree.yaml` with development tasks:
|
|
608
|
-
|
|
609
|
-
```bash
|
|
610
|
-
tt test # Run tests
|
|
611
|
-
tt build # Build wheel package
|
|
612
|
-
tt install-dev # Install package in development mode
|
|
613
|
-
tt clean # Remove build artifacts
|
|
614
|
-
```
|
|
615
|
-
|
|
616
|
-
## Releasing
|
|
617
|
-
|
|
618
|
-
New releases are created by pushing version tags to GitHub. The release workflow automatically:
|
|
619
|
-
- Builds wheel and source distributions
|
|
620
|
-
- Creates a GitHub Release with artifacts
|
|
621
|
-
- Publishes to PyPI via trusted publishing
|
|
622
|
-
|
|
623
|
-
### Release Process
|
|
624
|
-
|
|
625
|
-
1. Ensure main branch is ready:
|
|
626
|
-
```bash
|
|
627
|
-
git checkout main
|
|
628
|
-
git pull
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
2. Create and push a version tag:
|
|
632
|
-
```bash
|
|
633
|
-
git tag v1.0.0
|
|
634
|
-
git push origin v1.0.0
|
|
635
|
-
```
|
|
636
|
-
|
|
637
|
-
3. GitHub Actions will automatically:
|
|
638
|
-
- Extract version from tag (e.g., `v1.0.0` → `1.0.0`)
|
|
639
|
-
- Update `pyproject.toml` with the version
|
|
640
|
-
- Build wheel and sdist
|
|
641
|
-
- Create GitHub Release
|
|
642
|
-
- Publish to PyPI
|
|
643
|
-
|
|
644
|
-
4. Verify the release:
|
|
645
|
-
- GitHub: https://github.com/kevinchannon/task-tree/releases
|
|
646
|
-
- PyPI: https://pypi.org/kevinchannon/tasktree/
|
|
647
|
-
- Test: `pipx install --force tasktree`
|
|
648
|
-
|
|
649
|
-
### Version Numbering
|
|
650
|
-
|
|
651
|
-
Follow semantic versioning:
|
|
652
|
-
- `v1.0.0` - Major release (breaking changes)
|
|
653
|
-
- `v1.1.0` - Minor release (new features, backward compatible)
|
|
654
|
-
- `v1.1.1` - Patch release (bug fixes)
|
tasktree-0.0.7.dist-info/RECORD
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
tasktree/__init__.py,sha256=MVmdvKb3JdqLlo0x2_TPGMfgFC0HsDnP79HAzGnFnjI,1081
|
|
2
|
-
tasktree/cli.py,sha256=0xusNitT1AtLgR3guUsupnHSXJ0_C749Dx7dfYCENJA,15233
|
|
3
|
-
tasktree/docker.py,sha256=duIT5HkGBvLNOPdbgdXuqqUSwJgdWsb4Sxv_HVm8hzA,13118
|
|
4
|
-
tasktree/executor.py,sha256=8xNKPYkekhaGd_gCO7PT7E-n0JeHVtDgIbxACuvPUzU,28707
|
|
5
|
-
tasktree/graph.py,sha256=lA3ExNM_ag0AlC6iW20unseCjRg5wCZXbmXs2M6TnQw,5578
|
|
6
|
-
tasktree/hasher.py,sha256=dCyakihE4rHoOVCbt8hgTQZVuez3P1V0SrWUl-aM2Tw,1670
|
|
7
|
-
tasktree/parser.py,sha256=gkbzlTOwudJsU5gvgSCpVVY2GoYZlo_kLBVsIRbeZiU,19076
|
|
8
|
-
tasktree/state.py,sha256=Cktl4D8iDZVd55aO2LqVyPrc-BnljkesxxkcMcdcfOY,3541
|
|
9
|
-
tasktree/tasks.py,sha256=2QdQZtJAX2rSGbyXKG1z9VF_siz1DUzdvzCgPkykxtU,173
|
|
10
|
-
tasktree/types.py,sha256=w--sKjRTc8mGYkU5eAduqV86SolDqOYspAPuVKIuSQQ,3797
|
|
11
|
-
tasktree-0.0.7.dist-info/METADATA,sha256=YthtlFiUCaHTgO8n5jUsiJQ3py4pQ23_Zh3Ycshi4fk,17439
|
|
12
|
-
tasktree-0.0.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
13
|
-
tasktree-0.0.7.dist-info/entry_points.txt,sha256=lQINlvRYnimvteBbnhH84A9clTg8NnpEjCWqWkqg8KE,40
|
|
14
|
-
tasktree-0.0.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|