Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfv committed Mar 14, 2024
1 parent ce690f8 commit e71f92f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/advanced/advanced_tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,32 @@ This will add the following line to `pixi.toml`:
bar = { cmd = "python bar.py", cwd = "scripts" }
```

## Caching

When you specify `inputs` and/or `outputs` to a task, pixi will cache the result of the task.

For the cache, pixi checks that the following are true:

- No package in the environment has changed.
- The selected inputs and outputs are the same as the last time the task was run.
- The command is the same as the last time the task was run.

If all of these conditions are met, pixi will not run the task again and instead use the existing result.

Inputs and outputs can be specified as globs, which will be expanded to all matching files.

```toml title="pixi.toml"
[tasks]
# This task will only run if the `main.py` file has changed.
run = { cmd = "python main.py", inputs = ["main.py"] }

# This task will remember the result of the `curl` command and not run it again if the file `data.csv` already exists.
download_data = { cmd = "curl -o data.csv https://example.com/data.csv", outputs = ["data.csv"] }

# This task will only run if the `src` directory has changed and will remember the result of the `make` command.
build = { cmd = "make", inputs = ["src/*.cpp", "include/*.hpp"], outputs = ["build/app.exe"] }
```

## Our task runner: deno_task_shell

To support the different OS's (Windows, OSX and Linux), pixi integrates a shell that can run on all of them.
Expand Down

0 comments on commit e71f92f

Please sign in to comment.