Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for auto reload by watching a set of files in tasks #3286

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

prsabahrami
Copy link
Contributor

@prsabahrami prsabahrami commented Mar 6, 2025

This implements support for adding a set of watched files to each task in Pixi.
The tasks can be defined as below and will run in async watching for changes. The watches can be cancelled by pressing ctrl c.

watch-task = { cmd = "cat watched_file.txt", watched-files = ["watched_file.txt"] }

@prsabahrami prsabahrami changed the title initial commit for autoreload support feat: Add support for auto reload by watching a set of files in tasks Mar 6, 2025
@bollwyvl
Copy link
Contributor

File-based watching is a magical feature! Some thoughts:

Adding a new schema thing seems a bit unnecessary vs using the existing inputs.

To allow all existing pixi projects to benefit from this without having to rewrite anything, perhaps putting the feature behind a pixi watch (instead of run) would allow for reusing the task.taskname.inputs, and avoid surprises on e.g. CI where a watching task that never finishes would be a pretty big problem.

This further introduces the challenge of depends-on in the case of watching.

One option might be to gather the whole list of watched globs -> tasks, and rerun the correct one, in order, when their appropriate input changes. This behavior could be disabled via e.g. pixi watch --skip-deps taskname.

@prsabahrami prsabahrami marked this pull request as draft March 14, 2025 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants