Repository navigation
Conversation
4d8b3ef to
5b872ab
Compare
|
The Windows CI failure is a flaky |
Add isUpToDate() and checkUpToDate() to Builder and Environment, enabling applications to check whether an environment needs syncing without triggering a build. The fast isUpToDate() compares against appose.json; checkUpToDate() may additionally invoke tool-specific verification (e.g., uv sync --dry-run) and returns a CheckResult with a verified() flag.
|
I compared this PR with the new This idea of an optional, more expensive check for drift that can't be seen from the config may be worth including in Appose, but since it's a more expensive check, it should probably be its own method rather than including as part of @yzx9 If you need such a drift check, let me know, and we can introduce API for it. |
|
@ctrueden Thanks for reviewing this PR and for adding In my tests, > hyperfine --warmup 3 --runs 20 \
'uv sync --check --locked --offline'
Benchmark 1: uv sync --check --locked --offline
Time (mean ± σ): 29.0 ms ± 1.3 ms [User: 13.8 ms, System: 12.1 ms]
Range (min … max): 27.0 ms … 32.7 ms 20 runs
> ls .venv/lib/python3.12/site-packages/ | wc -l
813The bigger concern is that uv seems to be the only one of the three package managers with a straightforward, read-only environment consistency check. Perhaps a simpler, more consistent approach across package managers would be to just re-run the sync operation when needed. At least for uv, syncing an already up-to-date environment is nearly as fast as checking it: > hyperfine --warmup 3 --runs 20 \
'uv sync'
Benchmark 1: uv sync
Time (mean ± σ): 30.7 ms ± 3.2 ms [User: 14.5 ms, System: 12.7 ms]
Range (min … max): 28.8 ms … 43.5 ms 20 runs |
isUpToDate()andcheckUpToDate()to Builder and Environment, enabling applications to check whether an environment needs syncing without triggering a buildCheckResultinterface withisUpToDate(),description(), andverified(): theverified()flag indicates whether a real tool was invoked (vs. a fast config comparison)UvBuildersupports verified checks viauv sync --dry-runforpyproject.toml-based projects;PixiBuilderandMambaBuilderfall back to config-level checksclose apposed/appose#34
Test plan
CheckResultfactory methods,SimpleBuilderalways up-to-date,BaseBuilderstale when no env / stale after config change,DynamicBuilderdelegationuv env→isUpToDate()returns true → modify config → returns false;checkUpToDate()returnsverified=trueforpyproject.tomlprojects