Skip to content

Commit 967f327

Browse files
committed
Add pytask lock command
1 parent 0ea3cee commit 967f327

12 files changed

Lines changed: 1507 additions & 63 deletions

File tree

docs/source/_static/md/commands/build-options.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
| ---------------------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
33
| <code>-c, --config FILE</code> | - | Path to configuration file. |
44
| <code>--capture [fd\|no\|sys\|tee-sys]</code> | <code>fd</code> | Per task capturing method. |
5-
| <code>--clean-lockfile</code> | <code>false</code> | Rewrite the lockfile with only currently collected tasks. |
65
| <code>--database-url TEXT</code> | - | Url to the database. |
76
| <code>--debug-pytask</code> | <code>false</code> | Trace all function calls in the plugin framework. |
87
| <code>--disable-warnings</code> | <code>false</code> | Disables the summary for warnings. |

docs/source/_static/md/commands/command-list.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
| [`clean`](clean.md) | Clean the provided paths by removing files unknown to pytask. |
55
| [`collect`](collect.md) | Collect tasks and report information about them. |
66
| [`dag`](dag.md) | Create a visualization of the directed acyclic graph. |
7+
| [`lock`](lock.md) | Inspect and update recorded task state in the lockfile. |
78
| [`markers`](markers.md) | Show all registered markers. |
89
| [`profile`](profile.md) | Show information about resource consumption. |

docs/source/how_to_guides/portability.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ tasks run. If tasks are removed or renamed, their old entries remain as stale da
8585
are ignored.
8686

8787
To clean up stale entries without deleting the file, run
88-
[`pytask build --clean-lockfile`](../reference_guides/commands.md#pytask-build--clean-lockfile):
88+
[`pytask lock clean`](../reference_guides/commands.md#pytask-lock-clean):
8989

9090
```console
91-
$ pytask build --clean-lockfile
91+
$ pytask lock clean
9292
```
9393

94-
This rewrites the lockfile after a successful build with only the currently collected
95-
tasks and their current state values.
94+
This rewrites the lockfile with only the currently collected tasks and their current
95+
state values.

docs/source/reference_guides/lockfile.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ There are two portability concerns:
5151

5252
## Maintenance
5353

54-
Use [`pytask build --clean-lockfile`](commands.md#pytask-build--clean-lockfile) to
55-
rewrite `pytask.lock` with only currently collected tasks. The rewrite happens after a
56-
successful build and recomputes current state values without executing tasks again.
54+
Use [`pytask lock clean`](commands.md#pytask-lock-clean) to rewrite `pytask.lock` with
55+
only currently collected tasks. The command removes stale task entries without executing
56+
tasks again.
5757

5858
## File Format Reference
5959

src/_pytask/build.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def build( # noqa: PLR0913
7272
debug_pytask: bool = False,
7373
disable_warnings: bool = False,
7474
dry_run: bool = False,
75-
clean_lockfile: bool = False,
7675
editor_url_scheme: Literal["no_link", "file", "vscode", "pycharm"] # noqa: PYI051
7776
| str = "file",
7877
explain: bool = False,
@@ -132,8 +131,6 @@ def build( # noqa: PLR0913
132131
Whether warnings should be disabled and not displayed.
133132
dry_run : bool, default=False
134133
Whether a dry-run should be performed that shows which tasks need to be rerun.
135-
clean_lockfile : bool, default=False
136-
Whether the lockfile should be rewritten to only include collected tasks.
137134
editor_url_scheme : Literal["no_link", "file", "vscode", "pycharm"] | str
138135
A URL scheme that allows task, node, and file names to become clickable links.
139136
explain : bool, default=False
@@ -228,7 +225,6 @@ def build( # noqa: PLR0913
228225
"debug_pytask": debug_pytask,
229226
"disable_warnings": disable_warnings,
230227
"dry_run": dry_run,
231-
"clean_lockfile": clean_lockfile,
232228
"editor_url_scheme": editor_url_scheme,
233229
"explain": explain,
234230
"expression": expression,
@@ -357,12 +353,6 @@ def build( # noqa: PLR0913
357353
default=False,
358354
help="Execute a task even if it succeeded successfully before.",
359355
)
360-
@click.option(
361-
"--clean-lockfile",
362-
is_flag=True,
363-
default=False,
364-
help="Rewrite the lockfile with only currently collected tasks.",
365-
)
366356
@click.option(
367357
"--explain",
368358
is_flag=True,

0 commit comments

Comments
 (0)