Older `npm` releases silently ignore the seven-day dependency cooldown added in #27796. Require `npm` 11.10.0 or newer in the playground, playground API, and ty benchmark projects, and enable `engine-strict` so unsupported clients fail during `npm install` or `npm ci`. The lockfile changes only record that requirement; dependency versions and the existing cooldown are unchanged. Pin Node.js to `24.19.0` for the playground CI and publishing jobs, which provides a compatible bundled `npm`. The separate script-default changes are in #27837, and the locked playground deployment tool is in #27838. Related: astral-sh/ruff#27855 pins the remaining WebAssembly test and publication runtimes. astral-sh/setup-uv#1026 and astral-sh/ruff-action#411 enforce the same legacy-aware `npm` version floor. astral-sh/uv#21193 applies it to uv's locked formatter toolchain. --------- Co-authored-by: zaniebot <242828183+zaniebot@users.noreply.github.com>
2.8 KiB
Getting started
- Install
uv- Unix:
curl -LsSf https://astral.sh/uv/install.sh | sh - Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
- Unix:
- Build ty:
cargo build --bin ty --release cdinto the benchmark directory:cd scripts/ty_benchmark- Install npm 11.10.0 or newer, which supports the dependency cooldown in
.npmrc - Install Pyright:
npm ci --ignore-scripts - Run benchmarks:
uv run benchmark
Requires hyperfine 1.20 or newer.
Benchmarks
Cold check time
Run with:
uv run --python 3.14 benchmark
Measures how long it takes to type check a project without a pre-existing cache.
You can run the benchmark with --single-threaded to measure the check time when using a single thread only.
Warm check time
Run with:
uv run --python 3.14 benchmark --warm
Measures how long it takes to recheck a project if there were no changes.
Note
: Of the benchmarked type checkers, only mypy supports caching.
LSP: Time to first diagnostic
Measures how long it takes for a newly started LSP to return the diagnostics for the files open in the editor.
Run with:
uv run --python 3.14 pytest src/benchmark/test_lsp_diagnostics.py::test_fetch_diagnostics
Note: Use -v -s to see the set of diagnostics returned by each type checker.
LSP: Re-check time
Measure how long it takes to recheck all open files after making a single change in a file.
Run with:
uv run --python 3.14 pytest src/benchmark/test_lsp_diagnostics.py::test_incremental_edit
Note
: This benchmark uses pull diagnostics for type checkers that support this operation (ty), and falls back to publish diagnostics otherwise (Pyright, Pyrefly).
Known limitations
The tested type checkers implement Python's type system to varying degrees and some projects only successfully pass type checking using a specific type checker. We benchmark against the latest version of each type checker, but some projects may use another version in practice, leading to different diagnostic results between benchmarking and reality.
Updating the benchmark
The benchmark script supports snapshotting the results when running with --snapshot and --accept.
The goal of those snapshots is to catch accidental regressions. For example, if a project adds
new dependencies that we fail to install. They are not intended as a testing tool. E.g. the snapshot runner doesn't account for platform differences so that
you might see differences when running the snapshots on your machine.