Skip to content

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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
336ade5
initial commit for autoreload support
prsabahrami Mar 6, 2025
29df875
fix ruff formatting issues
prsabahrami Mar 6, 2025
9cbee7e
update unit tests on watcher and include access as a change as well
prsabahrami Mar 6, 2025
2f7c57e
run fmt
prsabahrami Mar 6, 2025
e84f679
use cross platform ctrl_c in tokio
prsabahrami Mar 6, 2025
c1b3294
update file watcher to handle modify events in deletion test
prsabahrami Mar 6, 2025
cf08f22
Fix formatting issue
prsabahrami Mar 6, 2025
369ae0d
use process.kill() on windows in tests instead of sending SIGINT
prsabahrami Mar 6, 2025
bcf481b
rebase
prsabahrami Mar 6, 2025
b0451d0
initial commit for pixi watch
prsabahrami Mar 14, 2025
a6bd5bc
fix: remove orchestrator and use tokio::Command instead of deno_task_…
prsabahrami Mar 18, 2025
e057958
Just support one task with no dependencies
prsabahrami Mar 18, 2025
760bcdc
refactor: replace reload with watcher
prsabahrami Mar 19, 2025
f5b263e
Merge main into feat_autoreload
prsabahrami Mar 19, 2025
3f57cbd
chore: remove unused dependency `notify-debouncer-mini` from Cargo.lock
prsabahrami Mar 19, 2025
f77ad02
chore: remove unused dependency `dashmap`
prsabahrami Mar 19, 2025
608e326
update cargo lockfile
prsabahrami Mar 19, 2025
f75d094
chore: update cargo lockfile in pixi_docs
prsabahrami Mar 19, 2025
4cca33a
fix: tests
prsabahrami Mar 19, 2025
5583fb4
chore: update cli docs
prsabahrami Mar 19, 2025
3846bce
chore: add annotations to the python test file
prsabahrami Mar 19, 2025
f2e5fc8
fix: update test for process behavior with empty inputs
prsabahrami Mar 19, 2025
fe583b8
fix: precommit
prsabahrami Mar 19, 2025
fe41904
fix: the input reading in tests
prsabahrami Mar 20, 2025
051f644
fix: the tests framework
prsabahrami Mar 21, 2025
644a7a4
chore: add python test annotation
prsabahrami Mar 21, 2025
a2f0893
chore: add support for windows in tests
prsabahrami Mar 21, 2025
4530a01
fix: use the task root instead of cwd for findings globs
prsabahrami Mar 21, 2025
a280117
chore: remove unrequired functions
prsabahrami Mar 21, 2025
a0fe755
Merge branch 'main' into feat_autoreload
prsabahrami Mar 21, 2025
90999cc
chore: update Cargo.lock with new dependencies and clean up unused ones
prsabahrami Mar 21, 2025
20464e7
Merge branch 'feat_autoreload' of github.com:prefix-dev/pixi into fea…
prsabahrami Mar 21, 2025
7311afa
chore: refactor task caching logic in watch
prsabahrami Mar 21, 2025
ab3e698
chore: remove help flags from watch command arguments and update cond…
prsabahrami Mar 31, 2025
e2ac885
Merge branch 'main' into feat_autoreload
prsabahrami Mar 31, 2025
5770303
[CI]: Update trampoline binaries for all targets
actions-user Mar 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 129 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ rattler_repodata_gateway = { version = "0.22.3", default-features = false }
rattler_shell = { version = "0.22.24", default-features = false }
rattler_solve = { version = "1.4.2", default-features = false }
rattler_virtual_packages = { version = "2.0.8", default-features = false }
rayon = { version = "1.10.0" }

# Bumping this to a higher version breaks the Windows path handling.
url = "2.5.4"
Expand Down Expand Up @@ -278,6 +279,8 @@ uv-pypi-types = { workspace = true }

ctrlc = { workspace = true }
fs-err = { workspace = true, features = ["tokio"] }
notify = "8.0.0"
notify-debouncer-full = "0.5.0"
pixi_allocator = { workspace = true, optional = true }
pixi_build_frontend = { workspace = true }
pixi_build_types = { workspace = true }
Expand All @@ -299,7 +302,7 @@ pixi_uv_conversions = { workspace = true }
pypi_mapping = { workspace = true }
pypi_modifiers = { workspace = true }
rattler_virtual_packages = { workspace = true }
rayon = "1.10.0"
rayon = { workspace = true }
regex = { workspace = true }
reqwest = { workspace = true, features = [
"http2",
Expand Down Expand Up @@ -342,6 +345,7 @@ uv-requirements-txt = { workspace = true }
uv-resolver = { workspace = true }
uv-types = { workspace = true }
uv-workspace = { workspace = true }
wax = { workspace = true, features = ["miette"] }
xxhash-rust = { workspace = true }
zip = { workspace = true, features = ["deflate", "time"] }
zstd = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions docs/reference/cli/pixi.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pixi [OPTIONS] <COMMAND>
| [`upgrade`](pixi/upgrade.md) | Checks if there are newer versions of the dependencies and upgrades them in the lockfile and manifest file |
| [`lock`](pixi/lock.md) | Solve environment and update the lock file without installing the environments |
| [`run`](pixi/run.md) | Runs task in the pixi environment |
| [`watch`](pixi/watch.md) | Runs task in the pixi environment and watch files for changes |
| [`exec`](pixi/exec.md) | Run a command and install it in a temporary environment |
| [`shell`](pixi/shell.md) | Start a shell in a pixi environment, run `exit` to leave the shell |
| [`shell-hook`](pixi/shell-hook.md) | Print the pixi environment activation script |
Expand Down
73 changes: 73 additions & 0 deletions docs/reference/cli/pixi/watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!--- This file is autogenerated. Do not edit manually! -->
# <code>[pixi](../pixi.md) watch</code>

## About
Runs task in the pixi environment and watch files for changes

--8<-- "docs/reference/cli/pixi/watch_extender.md:description"

## Usage
```
pixi watch [OPTIONS] [TASK]...
```

## Arguments
- <a id="arg-<TASK>" href="#arg-<TASK>">`<TASK>`</a>
: The pixi task or a task shell command you want to run in the workspace's environment, which can be an executable in the environment's PATH
<br>May be provided more than once.

## Config Options
- <a id="arg---tls-no-verify" href="#arg---tls-no-verify">`--tls-no-verify`</a>
: Do not verify the TLS certificate of the server
- <a id="arg---auth-file" href="#arg---auth-file">`--auth-file <AUTH_FILE>`</a>
: Path to the file containing the authentication token
- <a id="arg---pypi-keyring-provider" href="#arg---pypi-keyring-provider">`--pypi-keyring-provider <PYPI_KEYRING_PROVIDER>`</a>
: Specifies whether to use the keyring to look up credentials for PyPI
<br>**options**: `disabled`, `subprocess`
- <a id="arg---concurrent-solves" href="#arg---concurrent-solves">`--concurrent-solves <CONCURRENT_SOLVES>`</a>
: Max concurrent solves, default is the number of CPUs
- <a id="arg---concurrent-downloads" href="#arg---concurrent-downloads">`--concurrent-downloads <CONCURRENT_DOWNLOADS>`</a>
: Max concurrent network requests, default is `50`
- <a id="arg---force-activate" href="#arg---force-activate">`--force-activate`</a>
: Do not use the environment activation cache. (default: true except in experimental mode)
- <a id="arg---no-completion" href="#arg---no-completion">`--no-completion <NO_COMPLETION>`</a>
: Do not source the autocompletion scripts from the environment
<br>**options**: `true`, `false`

## Update Options
- <a id="arg---no-install" href="#arg---no-install">`--no-install`</a>
: Don't modify the environment, only modify the lock-file
- <a id="arg---revalidate" href="#arg---revalidate">`--revalidate`</a>
: Run the complete environment validation. This will reinstall a broken environment
- <a id="arg---no-lockfile-update" href="#arg---no-lockfile-update">`--no-lockfile-update`</a>
: Don't update lockfile, implies the no-install as well
- <a id="arg---frozen" href="#arg---frozen">`--frozen`</a>
: Install the environment as defined in the lockfile, doesn't update lockfile if it isn't up-to-date with the manifest file
<br>**env**: `PIXI_FROZEN`
- <a id="arg---locked" href="#arg---locked">`--locked`</a>
: Check if lockfile is up-to-date before installing the environment, aborts when lockfile isn't up-to-date with the manifest file
<br>**env**: `PIXI_LOCKED`
- <a id="arg---environment" href="#arg---environment">`--environment (-e) <ENVIRONMENT>`</a>
: The environment to run the task in
- <a id="arg---clean-env" href="#arg---clean-env">`--clean-env`</a>
: Use a clean environment to run the task
- <a id="arg---skip-deps" href="#arg---skip-deps">`--skip-deps`</a>
: Don't run the dependencies of the task ('depends-on' field in the task definition)
- <a id="arg---dry-run" href="#arg---dry-run">`--dry-run (-n)`</a>
: Run the task in dry-run mode (only print the command that would run)
- <a id="arg---help" href="#arg---help">`--help`</a>
:

## Global Options
- <a id="arg---manifest-path" href="#arg---manifest-path">`--manifest-path <MANIFEST_PATH>`</a>
: The path to `pixi.toml`, `pyproject.toml`, or the workspace directory

## Description
Runs task in the pixi environment and watch files for changes.

This command is used to run tasks in the pixi environment. The tasks are killed and ran again when the files specified in `inputs` change. It will activate the environment and run the task in the environment. It is using the deno_task_shell to run the task.

`pixi watch` will also update the lockfile and install the environment if it is required.


--8<-- "docs/reference/cli/pixi/watch_extender.md:example"
2 changes: 1 addition & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ test-integration-extra-slow-ci = "pytest --numprocesses=auto --durations=0 --tim
test-integration-fast = { cmd = "pytest --pixi-build=debug --numprocesses=auto --durations=0 --timeout=100 -m 'not slow and not extra_slow' tests/integration_python", depends-on = [
"build-debug",
] }
test-integration-slow = { cmd = "pytest --numprocesses=auto --durations=0 --timeout=100 -m 'not extra_slow' tests/integration_python", depends-on = [
test-integration-slow = { cmd = "pytest --numprocesses=auto --durations=0 --timeout=200 -m 'not extra_slow' tests/integration_python", depends-on = [
"build-release",
] }
# pass the file to run as an argument to the task
Expand Down
Loading