Skip to content

Commit 819dbfd

Browse files
committed
Document lockfile in tutorials
1 parent 4126acc commit 819dbfd

4 files changed

Lines changed: 27 additions & 2 deletions

File tree

docs/source/tutorials/defining_dependencies_products.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ my_project
3636
│ ├────task_data_preparation.py
3737
│ └────task_plot_data.py
3838
39+
├───pytask.lock
40+
3941
└───pyproject.toml
4042
```
4143

@@ -107,6 +109,10 @@ Now, let us execute the two paths.
107109

108110
--8<-- "docs/source/_static/md/defining-dependencies-products.md"
109111

112+
The build updates `pytask.lock` with the state of both tasks. When you run the same
113+
tasks again without changing their dependencies, products, or source files, pytask uses
114+
the lockfile to skip them.
115+
110116
## Relative paths
111117

112118
Dependencies and products do not have to be absolute paths. If paths are relative, they

docs/source/tutorials/set_up_a_project.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ move to the next section of the tutorials.
1414

1515
## The directory structure
1616

17-
The following directory tree gives an overview of the project's different parts.
17+
The following directory tree gives an overview of the project's different parts after
18+
the first build.
1819

1920
```text
2021
my_project
@@ -30,13 +31,16 @@ my_project
3031
│ ├────config.py
3132
│ └────...
3233
34+
├───pytask.lock
35+
3336
└───pyproject.toml
3437
```
3538

36-
Replicate this directory structure for your project or start from pytask's
39+
Create the project files and folders for your project or start from pytask's
3740
[cookiecutter-pytask-project](https://github.com/pytask-dev/cookiecutter-pytask-project)
3841
template or any other
3942
[linked template or example project](../how_to_guides/bp_templates_and_projects.md).
43+
pytask creates the `.pytask` folder and `pytask.lock` file during builds.
4044

4145
## The `src` directory
4246

@@ -134,6 +138,12 @@ The `[tool.pytask.ini_options]` section tells pytask to look for tasks in
134138
The `.pytask` directory is where pytask stores its information. You do not need to
135139
interact with it.
136140

141+
## The `pytask.lock` file
142+
143+
The `pytask.lock` file records which tasks and products are up to date. pytask updates
144+
it during builds so later runs can skip unchanged tasks. This file should be kept in
145+
version control.
146+
137147
## Installation
138148

139149
=== "uv"

docs/source/tutorials/using_a_data_catalog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ my_project
3636
│ ├────task_data_preparation.py
3737
│ └────task_plot_data.py
3838
39+
├───pytask.lock
40+
3941
└───pyproject.toml
4042
```
4143

@@ -148,6 +150,8 @@ my_project
148150
149151
├───pyproject.toml
150152
153+
├───pytask.lock
154+
151155
├───src
152156
│ └───my_project
153157
│ ├────config.py

docs/source/tutorials/write_a_task.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ my_project
2424
│ ├────config.py
2525
│ └────task_data_preparation.py
2626
27+
├───pytask.lock
28+
2729
└───pyproject.toml
2830
```
2931

@@ -78,6 +80,9 @@ Now, execute pytask to collect tasks in the current and subsequent directories.
7880

7981
--8<-- "docs/source/_static/md/write-a-task.md"
8082

83+
After the task succeeds, pytask writes `pytask.lock` next to `pyproject.toml`. Keep this
84+
file under version control so later builds can detect unchanged tasks.
85+
8186
<a id="customize-task-names"></a>
8287

8388
## Customize task names

0 commit comments

Comments
 (0)