invoke-toolkit 0.0.74__tar.gz → 0.0.75__tar.gz
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.
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/PKG-INFO +32 -1
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/README.md +31 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/program/program.py +62 -2
- invoke_toolkit-0.0.75/src/invoke_toolkit/program/task_changes.py +184 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/scripts/loader.py +2 -0
- invoke_toolkit-0.0.75/tests/test_list_changed.py +383 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/.gitignore +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/LICENSE.txt +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/pyproject.toml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/__main__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/collections.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/completion.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/config/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/config/config.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/config/registry.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/config/schema.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/config/status_helper.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/context/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/context/async_tools.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/context/context.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/context/types.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/executor.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/tasks/config.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/tasks/create.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/tasks/dist.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/tasks/plugin.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/tasks/shell.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/extensions/uv_tools.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/field_resolvers.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/loader/entrypoint.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/log/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/log/logger.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/output/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/output/console.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/output/utils.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/parser.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/program/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/program/main.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/py.typed +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/runners/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/runners/rich.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/scripts/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/tasks/autocomplete.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/tasks/cache.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/tasks/fields.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/tasks/fields.pyi +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/tasks/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/tasks/types.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/testing.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/utils/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/utils/fzf.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/utils/inspection.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/utils/singleton.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/src/invoke_toolkit/utils/text.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/package-template/.gitignore.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/package-template/README.md.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/package-template/copier.yml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/package-template/pyproject.toml.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/package-template/src/{{package_slug}}/__init__.py.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/package-template/src/{{package_slug}}/tasks.py.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/provider-template/.gitignore.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/provider-template/README.md.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/provider-template/copier.yml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/provider-template/pyproject.toml.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/provider-template/src/{{package_slug}}/__init__.py.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/templates/provider-template/tests/test_resolver.py.jinja +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/conftest.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/cached_completion/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/completion_with_config/.gitignore +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/completion_with_config/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/config_schema/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/enum_select_size/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/fzf_selector/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/literal_set_level/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/local_field_resolver/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/local_tasks/local_tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/examples/local_tasks/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/extensions/conftest.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/extensions/test_config_tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/extensions/test_create.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/extensions/test_package_template_entrypoint.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/extensions/test_shell_tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/extensions/test_uv_plugins.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/fixtures/future_fields.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/integration/pty_plugin_completion.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/integration/uv_tool_plugins.sh +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/all-four/invoke.json +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/all-four/invoke.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/all-four/invoke.yml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/collection.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/echo.yaml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/json/invoke.json +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/json-and-python/invoke.json +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/json-and-python/invoke.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/no-dedupe.yaml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/no-echo.yaml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/package/invoke.yml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/package/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/python/invoke.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/runtime.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/three-of-em/invoke.json +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/three-of-em/invoke.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/three-of-em/invoke.yml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/underscores/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/yaml/explicit.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/yaml/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/yml/explicit.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/yml/invoke.yml +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/configs/yml/tasks.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/_support/has_modules.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/conftest.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/original_invoke/test_config.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/program/main.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/program/tasks/__init__.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/program/tasks/coll1.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/script/test_script.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/tasks/test_cache.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/tasks/test_extensions_config.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_alias_self_reference.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_annotated_help.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_async_edge_cases.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_async_support.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_cofig_class.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_collection.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_collection_configure.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_completion_with_choices.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_config_helper.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_config_registry.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_config_schema.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_console.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_context_class.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_disable_status_cli.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_enum_arguments.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_executor.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_field_typing.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_fields.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_file_completion.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_global_context.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_help_flags.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_invoke_3_compat.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_invoke_compatibility.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_list_filter_flags.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_loader.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_parsing.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_proctitle.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_program_with_collection.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_pty_stdin.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_release_guard.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_task_suggestions.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/test_toplevel.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/typecheck/fields.py +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/typecheck/fields_negative.py.fixture +0 -0
- {invoke_toolkit-0.0.74 → invoke_toolkit-0.0.75}/tests/utils/test_fzf.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: invoke-toolkit
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.75
|
|
4
4
|
Summary: Extended APIs for PyInvoke: composable task plugins, typed CLI args, Rich output, shell completion, and PEP 723 script support
|
|
5
5
|
Project-URL: Documentation, https://github.com/D3f0/invoke-toolkit#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/D3f0/invoke-toolkit/issues
|
|
@@ -130,6 +130,37 @@ intk local.my-task
|
|
|
130
130
|
|
|
131
131
|
Local tasks are automatically discovered and added to the `local` namespace, allowing you to keep project-specific tasks separate from your main task collection.
|
|
132
132
|
|
|
133
|
+
### Listing changed tasks
|
|
134
|
+
|
|
135
|
+
For a Git-managed PEP 723 script that calls `invoke_toolkit.script()`:
|
|
136
|
+
|
|
137
|
+
```console
|
|
138
|
+
uv run tasks.py --list-changed
|
|
139
|
+
uv run tasks.py --list-changed --list-format json
|
|
140
|
+
uv run tasks.py --list
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`--list-changed` lists only new or updated task definitions compared with Git
|
|
144
|
+
`HEAD`, including staged and unstaged edits. Normal flat and nested listings
|
|
145
|
+
also highlight new tasks in green and updated tasks in yellow. Color follows
|
|
146
|
+
Rich's terminal detection and `NO_COLOR`; JSON retains Invoke's existing schema.
|
|
147
|
+
The flag also works with `intk --list-changed` for a loaded task file, and can
|
|
148
|
+
combine with `--list <namespace>`, `--list-tasks`, or `--list-plugins` to narrow
|
|
149
|
+
the listing further.
|
|
150
|
+
|
|
151
|
+
Comparison includes task bodies, signatures, decorators, and docstrings, but
|
|
152
|
+
ignores comments, formatting, and line-number shifts. Imported tasks and
|
|
153
|
+
indirect changes through helpers or globals are not included. Historical source
|
|
154
|
+
is parsed, never executed. In a Git repository, every task in a file absent
|
|
155
|
+
from `HEAD` (including a new repository without commits) counts as new.
|
|
156
|
+
Adding a task decorator to a helper counts as new; changing the decorator's
|
|
157
|
+
explicit task name counts as an update to that existing definition.
|
|
158
|
+
|
|
159
|
+
With no changes, the flag exits successfully with an empty JSON task list or a
|
|
160
|
+
message for human-readable formats. Outside a Git repository, or without Git,
|
|
161
|
+
`--list-changed` reports an error; normal listing still works without highlights.
|
|
162
|
+
|
|
163
|
+
|
|
133
164
|
### Using Task Caching
|
|
134
165
|
|
|
135
166
|
Cache expensive task results with the `cache` parameter:
|
|
@@ -69,6 +69,37 @@ intk local.my-task
|
|
|
69
69
|
|
|
70
70
|
Local tasks are automatically discovered and added to the `local` namespace, allowing you to keep project-specific tasks separate from your main task collection.
|
|
71
71
|
|
|
72
|
+
### Listing changed tasks
|
|
73
|
+
|
|
74
|
+
For a Git-managed PEP 723 script that calls `invoke_toolkit.script()`:
|
|
75
|
+
|
|
76
|
+
```console
|
|
77
|
+
uv run tasks.py --list-changed
|
|
78
|
+
uv run tasks.py --list-changed --list-format json
|
|
79
|
+
uv run tasks.py --list
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`--list-changed` lists only new or updated task definitions compared with Git
|
|
83
|
+
`HEAD`, including staged and unstaged edits. Normal flat and nested listings
|
|
84
|
+
also highlight new tasks in green and updated tasks in yellow. Color follows
|
|
85
|
+
Rich's terminal detection and `NO_COLOR`; JSON retains Invoke's existing schema.
|
|
86
|
+
The flag also works with `intk --list-changed` for a loaded task file, and can
|
|
87
|
+
combine with `--list <namespace>`, `--list-tasks`, or `--list-plugins` to narrow
|
|
88
|
+
the listing further.
|
|
89
|
+
|
|
90
|
+
Comparison includes task bodies, signatures, decorators, and docstrings, but
|
|
91
|
+
ignores comments, formatting, and line-number shifts. Imported tasks and
|
|
92
|
+
indirect changes through helpers or globals are not included. Historical source
|
|
93
|
+
is parsed, never executed. In a Git repository, every task in a file absent
|
|
94
|
+
from `HEAD` (including a new repository without commits) counts as new.
|
|
95
|
+
Adding a task decorator to a helper counts as new; changing the decorator's
|
|
96
|
+
explicit task name counts as an update to that existing definition.
|
|
97
|
+
|
|
98
|
+
With no changes, the flag exits successfully with an empty JSON task list or a
|
|
99
|
+
message for human-readable formats. Outside a Git repository, or without Git,
|
|
100
|
+
`--list-changed` reports an error; normal listing still works without highlights.
|
|
101
|
+
|
|
102
|
+
|
|
72
103
|
### Using Task Caching
|
|
73
104
|
|
|
74
105
|
Cache expensive task results with the `cache` parameter:
|
|
@@ -21,6 +21,7 @@ from pathlib import Path
|
|
|
21
21
|
from typing import Any, Literal
|
|
22
22
|
|
|
23
23
|
from rich.table import Table
|
|
24
|
+
from rich.markup import escape
|
|
24
25
|
|
|
25
26
|
from invoke_toolkit.log.logger import setup_rich_logging, setup_traceback_handler
|
|
26
27
|
from invoke_toolkit.output import get_console
|
|
@@ -56,6 +57,7 @@ from invoke_toolkit.config import ToolkitConfig
|
|
|
56
57
|
from invoke_toolkit.executor import ToolkitExecutor
|
|
57
58
|
from invoke_toolkit.loader.entrypoint import EntryPointLoader
|
|
58
59
|
from invoke_toolkit.parser import ToolkitArgument
|
|
60
|
+
from invoke_toolkit.program.task_changes import Change, filter_changed, task_changes
|
|
59
61
|
|
|
60
62
|
EMPTY_COLLECTION_NAME = "_empty"
|
|
61
63
|
|
|
@@ -69,7 +71,7 @@ def _task_bodies(items: Sequence[Any]) -> Iterator[Any]:
|
|
|
69
71
|
yield item.body
|
|
70
72
|
|
|
71
73
|
|
|
72
|
-
class ToolkitProgram(Program):
|
|
74
|
+
class ToolkitProgram(Program): # pylint: disable=too-many-instance-attributes
|
|
73
75
|
"""Invoke Toolkit program providing rich output, package versioning and other features"""
|
|
74
76
|
|
|
75
77
|
def __init__(
|
|
@@ -96,6 +98,8 @@ class ToolkitProgram(Program):
|
|
|
96
98
|
# Names of sub-collections that were loaded from entry-point plugins.
|
|
97
99
|
# Populated in load_collection(); used by --list-tasks / --list-plugins.
|
|
98
100
|
self._plugin_collection_names: set[str] = set()
|
|
101
|
+
self._task_source: Path | None = None
|
|
102
|
+
self._task_changes: dict[str, Change] = {}
|
|
99
103
|
|
|
100
104
|
def get_version(self) -> str:
|
|
101
105
|
"""Compute version
|
|
@@ -456,19 +460,26 @@ class ToolkitProgram(Program):
|
|
|
456
460
|
default=False,
|
|
457
461
|
help="List only the plugin-provided task collections (excludes main tasks)",
|
|
458
462
|
),
|
|
463
|
+
ToolkitArgument(
|
|
464
|
+
names=("list-changed",),
|
|
465
|
+
kind=bool,
|
|
466
|
+
default=False,
|
|
467
|
+
help="List only tasks created or updated in the task file since Git HEAD",
|
|
468
|
+
),
|
|
459
469
|
]
|
|
460
470
|
args.extend(toolkit_program_arguments)
|
|
461
471
|
return args
|
|
462
472
|
|
|
463
473
|
def _handle_list_flags(self) -> None:
|
|
464
474
|
"""
|
|
465
|
-
Handle --list, --list-tasks, and --list-
|
|
475
|
+
Handle --list, --list-tasks, --list-plugins and --list-changed flags.
|
|
466
476
|
|
|
467
477
|
Sets ``list_format`` / ``list_depth`` / ``scoped_collection`` as needed
|
|
468
478
|
and raises `Exit` when any listing flag is active.
|
|
469
479
|
"""
|
|
470
480
|
self.list_format = self.args["list-format"].value
|
|
471
481
|
self.list_depth = self.args["list-depth"].value
|
|
482
|
+
self._task_changes = {}
|
|
472
483
|
|
|
473
484
|
# --list [root]: standard task listing (optionally scoped to a sub-collection)
|
|
474
485
|
list_root = self.args.list.value # True or a string namespace
|
|
@@ -500,6 +511,48 @@ class ToolkitProgram(Program):
|
|
|
500
511
|
self.list_tasks()
|
|
501
512
|
raise Exit
|
|
502
513
|
|
|
514
|
+
if self.args["list-changed"].value:
|
|
515
|
+
self.list_tasks()
|
|
516
|
+
raise Exit
|
|
517
|
+
|
|
518
|
+
def list_tasks(self) -> None:
|
|
519
|
+
"""Highlight source changes and optionally restrict the listing to them."""
|
|
520
|
+
only_changed = self.args["list-changed"].value
|
|
521
|
+
source = self._task_source
|
|
522
|
+
if source is None:
|
|
523
|
+
if only_changed:
|
|
524
|
+
raise Exit("--list-changed requires a task source file.", code=1)
|
|
525
|
+
elif only_changed or self.list_format != "json":
|
|
526
|
+
try:
|
|
527
|
+
self._task_changes = task_changes(self.scoped_collection, source)
|
|
528
|
+
except Exit:
|
|
529
|
+
if only_changed:
|
|
530
|
+
raise
|
|
531
|
+
if only_changed:
|
|
532
|
+
self.scoped_collection = filter_changed(
|
|
533
|
+
self.scoped_collection, self._task_changes
|
|
534
|
+
)
|
|
535
|
+
if not self.scoped_collection:
|
|
536
|
+
if self.list_format == "json":
|
|
537
|
+
self.list_json()
|
|
538
|
+
else:
|
|
539
|
+
get_console("out").print("No new or updated tasks since Git HEAD.")
|
|
540
|
+
return
|
|
541
|
+
super().list_tasks()
|
|
542
|
+
|
|
543
|
+
def _make_pairs(self, coll, ancestors=None):
|
|
544
|
+
"""Style task rows while leaving Invoke's namespace formatting intact."""
|
|
545
|
+
pairs = super()._make_pairs(coll, ancestors)
|
|
546
|
+
prefix = ".".join(ancestors or [])
|
|
547
|
+
for index, name in enumerate(sorted(coll.tasks)):
|
|
548
|
+
qualified = f"{prefix}.{name}" if prefix else name
|
|
549
|
+
change = self._task_changes.get(qualified)
|
|
550
|
+
if change:
|
|
551
|
+
label, description = pairs[index]
|
|
552
|
+
style = "bold green" if change == "new" else "bold yellow"
|
|
553
|
+
pairs[index] = (f"[{style}]{escape(label)}[/{style}]", description)
|
|
554
|
+
return pairs
|
|
555
|
+
|
|
503
556
|
def _make_filtered_collection(
|
|
504
557
|
self, mode: "Literal['tasks', 'plugins']"
|
|
505
558
|
) -> "ToolkitCollection":
|
|
@@ -580,6 +633,7 @@ class ToolkitProgram(Program):
|
|
|
580
633
|
|
|
581
634
|
Ensures that the type is ToolkitCollection for correctness.
|
|
582
635
|
"""
|
|
636
|
+
self._task_source = None
|
|
583
637
|
# NOTE: start, coll_name both fall back to configuration values within
|
|
584
638
|
# Loader (which may, however, get them from our config.)
|
|
585
639
|
start = self.args["search-root"].value
|
|
@@ -592,6 +646,8 @@ class ToolkitProgram(Program):
|
|
|
592
646
|
coll_name = self.args.collection.value
|
|
593
647
|
try:
|
|
594
648
|
module, parent = loader.load(coll_name)
|
|
649
|
+
if getattr(module, "__file__", None):
|
|
650
|
+
self._task_source = Path(module.__file__)
|
|
595
651
|
# This is the earliest we can load project config, so we should -
|
|
596
652
|
# allows project config to affect the task parsing step!
|
|
597
653
|
# TODO: is it worth merging these set- and load- methods? May
|
|
@@ -789,6 +845,10 @@ class ToolkitProgram(Program):
|
|
|
789
845
|
print = get_console("out").print
|
|
790
846
|
root = self.list_root
|
|
791
847
|
print(f"{self.task_list_opener(extra=extra)}:\n")
|
|
848
|
+
if self._task_changes:
|
|
849
|
+
print(
|
|
850
|
+
"[bold green]new[/bold green] / [bold yellow]updated[/bold yellow] since Git HEAD\n"
|
|
851
|
+
)
|
|
792
852
|
self.print_columns(pairs)
|
|
793
853
|
# TODO: worth stripping this out for nested? since it's signified with
|
|
794
854
|
# asterisk there? ugggh
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"""Compare loaded task definitions with their Git HEAD source, without executing it."""
|
|
2
|
+
|
|
3
|
+
import ast
|
|
4
|
+
import inspect
|
|
5
|
+
import os
|
|
6
|
+
import subprocess
|
|
7
|
+
from collections.abc import Iterator
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
from typing import Literal
|
|
10
|
+
|
|
11
|
+
from invoke.collection import Collection
|
|
12
|
+
from invoke.exceptions import Exit
|
|
13
|
+
|
|
14
|
+
Change = Literal["new", "updated"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _git(path: Path, *args: str) -> subprocess.CompletedProcess[bytes]:
|
|
18
|
+
try:
|
|
19
|
+
return subprocess.run(
|
|
20
|
+
["git", "-C", str(path.parent), *args], capture_output=True, check=False
|
|
21
|
+
)
|
|
22
|
+
except OSError as error:
|
|
23
|
+
raise Exit("Git is required for --list-changed.", code=1) from error
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _head_source(path: Path) -> bytes:
|
|
27
|
+
root = _git(path, "rev-parse", "--show-toplevel")
|
|
28
|
+
if root.returncode:
|
|
29
|
+
raise Exit("--list-changed requires a task file in a Git repository.", code=1)
|
|
30
|
+
relative = path.relative_to(Path(os.fsdecode(root.stdout).rstrip("\n")).resolve())
|
|
31
|
+
if _git(path, "rev-parse", "--verify", "--quiet", "HEAD").returncode:
|
|
32
|
+
return b""
|
|
33
|
+
tree = _git(
|
|
34
|
+
path,
|
|
35
|
+
"ls-tree",
|
|
36
|
+
"--full-tree",
|
|
37
|
+
"-z",
|
|
38
|
+
"HEAD",
|
|
39
|
+
"--",
|
|
40
|
+
f":(literal){relative.as_posix()}",
|
|
41
|
+
)
|
|
42
|
+
if tree.returncode:
|
|
43
|
+
raise Exit("Unable to read task file history from Git HEAD.", code=1)
|
|
44
|
+
if not tree.stdout:
|
|
45
|
+
return b""
|
|
46
|
+
source = _git(path, "show", f"HEAD:{relative.as_posix()}")
|
|
47
|
+
if source.returncode:
|
|
48
|
+
raise Exit("Unable to read task file from Git HEAD.", code=1)
|
|
49
|
+
return source.stdout
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _module_functions(
|
|
53
|
+
node: ast.AST,
|
|
54
|
+
) -> Iterator[ast.FunctionDef | ast.AsyncFunctionDef]:
|
|
55
|
+
"""Find module-scope functions, including control flow but excluding nested scopes."""
|
|
56
|
+
if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
|
|
57
|
+
yield node
|
|
58
|
+
elif not isinstance(node, (ast.ClassDef, ast.Lambda)):
|
|
59
|
+
for child in ast.iter_child_nodes(node):
|
|
60
|
+
yield from _module_functions(child)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _task_decorated(
|
|
64
|
+
node: ast.FunctionDef | ast.AsyncFunctionDef, tree: ast.Module
|
|
65
|
+
) -> bool:
|
|
66
|
+
"""Recognize task decorators, including imported aliases, without execution."""
|
|
67
|
+
names = {"task"}
|
|
68
|
+
for item in ast.walk(tree):
|
|
69
|
+
if isinstance(item, ast.ImportFrom) and item.module in {
|
|
70
|
+
"invoke_toolkit",
|
|
71
|
+
"invoke",
|
|
72
|
+
"invoke.tasks",
|
|
73
|
+
"invoke_toolkit.tasks",
|
|
74
|
+
}:
|
|
75
|
+
names.update(
|
|
76
|
+
alias.asname or alias.name
|
|
77
|
+
for alias in item.names
|
|
78
|
+
if alias.name == "task"
|
|
79
|
+
)
|
|
80
|
+
for decorator in node.decorator_list:
|
|
81
|
+
target = decorator.func if isinstance(decorator, ast.Call) else decorator
|
|
82
|
+
if isinstance(target, ast.Name) and target.id in names:
|
|
83
|
+
return True
|
|
84
|
+
if isinstance(target, ast.Attribute) and target.attr == "task":
|
|
85
|
+
return True
|
|
86
|
+
pending: list[ast.AST] = []
|
|
87
|
+
pending.extend(tree.body)
|
|
88
|
+
while pending:
|
|
89
|
+
item = pending.pop()
|
|
90
|
+
if isinstance(item, (ast.FunctionDef, ast.AsyncFunctionDef, ast.ClassDef)):
|
|
91
|
+
continue
|
|
92
|
+
if isinstance(item, (ast.Assign, ast.AnnAssign)) and isinstance(
|
|
93
|
+
item.value, ast.Call
|
|
94
|
+
):
|
|
95
|
+
call = item.value
|
|
96
|
+
if any(
|
|
97
|
+
isinstance(arg, ast.Name) and arg.id == node.name for arg in call.args
|
|
98
|
+
):
|
|
99
|
+
target = (
|
|
100
|
+
call.func.func if isinstance(call.func, ast.Call) else call.func
|
|
101
|
+
)
|
|
102
|
+
if isinstance(target, ast.Name) and target.id in names:
|
|
103
|
+
return True
|
|
104
|
+
if isinstance(target, ast.Attribute) and target.attr == "task":
|
|
105
|
+
return True
|
|
106
|
+
pending.extend(ast.iter_child_nodes(item))
|
|
107
|
+
return False
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def task_changes(collection: Collection, source_path: Path) -> dict[str, Change]: # pylint: disable=too-many-locals
|
|
111
|
+
"""Return canonical task paths changed in the source file since HEAD.
|
|
112
|
+
|
|
113
|
+
Only the task's own definition is compared; imported tasks and indirect
|
|
114
|
+
changes to helpers or globals are outside this comparison.
|
|
115
|
+
"""
|
|
116
|
+
path = source_path.resolve()
|
|
117
|
+
try:
|
|
118
|
+
current = ast.parse(path.read_bytes(), filename=str(path))
|
|
119
|
+
previous = ast.parse(_head_source(path), filename=f"HEAD:{path.name}")
|
|
120
|
+
except (OSError, SyntaxError, ValueError) as error:
|
|
121
|
+
raise Exit(
|
|
122
|
+
"Unable to compare task definitions with Git HEAD.", code=1
|
|
123
|
+
) from error
|
|
124
|
+
old: dict[str, list[ast.FunctionDef | ast.AsyncFunctionDef]] = {}
|
|
125
|
+
for node in _module_functions(previous):
|
|
126
|
+
old.setdefault(node.name, []).append(node)
|
|
127
|
+
current_nodes = list(_module_functions(current))
|
|
128
|
+
occurrences: dict[str, int] = {}
|
|
129
|
+
definitions = {}
|
|
130
|
+
for node in current_nodes:
|
|
131
|
+
occurrence = occurrences.get(node.name, 0)
|
|
132
|
+
occurrences[node.name] = occurrence + 1
|
|
133
|
+
line = min([node.lineno, *(d.lineno for d in node.decorator_list)])
|
|
134
|
+
definitions[(node.name, line)] = (node, occurrence)
|
|
135
|
+
changes: dict[str, Change] = {}
|
|
136
|
+
for name in collection.task_names:
|
|
137
|
+
body = inspect.unwrap(collection[name].body)
|
|
138
|
+
code = getattr(body, "__code__", None)
|
|
139
|
+
if code is None or Path(code.co_filename).resolve() != path:
|
|
140
|
+
continue
|
|
141
|
+
definition = definitions.get((body.__name__, code.co_firstlineno))
|
|
142
|
+
if definition is None:
|
|
143
|
+
continue
|
|
144
|
+
node, occurrence = definition
|
|
145
|
+
candidates = old.get(node.name, [])
|
|
146
|
+
historical = candidates[occurrence] if occurrence < len(candidates) else None
|
|
147
|
+
if historical is None or (
|
|
148
|
+
_task_decorated(node, current) and not _task_decorated(historical, previous)
|
|
149
|
+
):
|
|
150
|
+
changes[name] = "new"
|
|
151
|
+
elif ast.dump(node) != ast.dump(historical):
|
|
152
|
+
changes[name] = "updated"
|
|
153
|
+
return changes
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def filter_changed(
|
|
157
|
+
collection: Collection, changes: dict[str, Change], prefix: str = ""
|
|
158
|
+
) -> Collection:
|
|
159
|
+
"""Copy the listing tree, retaining changed tasks, aliases and defaults."""
|
|
160
|
+
filtered = Collection(
|
|
161
|
+
collection.name or "", auto_dash_names=collection.auto_dash_names
|
|
162
|
+
)
|
|
163
|
+
for name, task in collection.tasks.items():
|
|
164
|
+
if prefix + name in changes:
|
|
165
|
+
filtered.add_task(
|
|
166
|
+
task,
|
|
167
|
+
name=name,
|
|
168
|
+
aliases=tuple(collection.tasks.aliases_of(name)),
|
|
169
|
+
default=False,
|
|
170
|
+
)
|
|
171
|
+
for name, child in collection.collections.items():
|
|
172
|
+
selected = filter_changed(child, changes, prefix + name + ".")
|
|
173
|
+
if selected:
|
|
174
|
+
filtered.add_collection(selected, name=name)
|
|
175
|
+
for alias in collection.collections.aliases_of(name):
|
|
176
|
+
filtered.collections.alias(alias, to=name)
|
|
177
|
+
filtered.__doc__ = collection.__doc__
|
|
178
|
+
filtered.default = (
|
|
179
|
+
collection.default
|
|
180
|
+
if collection.default in filtered.tasks
|
|
181
|
+
or collection.default in filtered.collections
|
|
182
|
+
else None
|
|
183
|
+
)
|
|
184
|
+
return filtered
|
|
@@ -4,6 +4,7 @@ Run scripts with https://peps.python.org/pep-0723/
|
|
|
4
4
|
|
|
5
5
|
import inspect
|
|
6
6
|
import traceback
|
|
7
|
+
from pathlib import Path
|
|
7
8
|
from types import FrameType
|
|
8
9
|
|
|
9
10
|
from invoke.tasks import Task
|
|
@@ -98,4 +99,5 @@ def script(
|
|
|
98
99
|
p = ToolkitProgram(namespace=c, config_class=CustomConfig)
|
|
99
100
|
else:
|
|
100
101
|
p = ToolkitProgram(namespace=c)
|
|
102
|
+
p._task_source = Path(frame.f_code.co_filename) # pylint: disable=protected-access
|
|
101
103
|
return p.run(argv=argv, exit=exit)
|