-
Notifications
You must be signed in to change notification settings - Fork 277
feat: Add support for auto reload by watching a set of files in tasks #3286
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
base: main
Are you sure you want to change the base?
Conversation
File-based watching is a magical feature! Some thoughts: Adding a new schema thing seems a bit unnecessary vs using the existing To allow all existing This further introduces the challenge of One option might be to gather the whole list of watched globs -> tasks, and rerun the correct one, in order, when their appropriate |
032a083
to
a280117
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the description with the full design idea so I can validate it and see if it works as expected?
…itional check for task execution
@Hofer-Julian updated the description! |
This PR introduces a new feature to
pixi
,pixi watch
allowing it to watch files for changes and rerun tasks automatically.The tasks can be defined as they would have been defined before and hence no changes are needed in the
pixi.toml
file.The
pixi watch
command looks at the globs in theinputs
field of a task and runs the task. Then watches the files that match the glob (relative to project root), then kills the previous task and reruns the task command.For example, if the below is defined in the
pixi.toml
file:running
pixi watch watch-test
will print echo to the stdout whenever any text file is updated (or created) in the root directory until the user cancels it byctrl_c
.I added a
FileWatcher
struct that usesrayon
andnotify
to handle the file watching.The expected behaviour for when the set of inputs is empty is for the task to quit as though
pixi run
was used.