An extremely fast, highly opinionated test scheduler for pytest.
The name comes from the Russian быстро (bystro), meaning “fast” or “quickly.”
Bistra is built for real test suites with uneven runtimes. It uses timing history to balance work across workers and reduce the wait for the last worker.
Run your tests with bistra. Keep your pytest fixtures, plugins, and options.
Benchmarked on nine open-source projects, including pytest, Polars, SQLAlchemy, and Textual. Charts show one project.
- Machine: Apple M4 Max, macOS.
- Workers: 12 for Bistra and xdist; 1 for pytest.
- Timing history: none for cold runs, reused for warm runs.
uv add --dev bistra
uv run bistraUse your usual pytest options with bistra.
Workers default to the available CPU count. Override with -j or --workers:
uv run bistra -j 8Try a few worker counts; the fastest setting depends on your machine and test suite.
Paste this into your agent:
Install Bistra and switch our local and CI test commands to `uv run bistra`.
Keep our existing plugins and test settings, remove xdist scheduling options,
and check that the tests still pass.
Works with pytest-cov and pytest-testmon using their usual options:
uv run bistra --cov=my_package --cov-report=xml
uv run bistra --testmonBistra replaces xdist scheduling. Remove xdist options (-n, --dist,
--looponfail) from your commands and pytest config; xdist can stay installed.
- Timing history. Balances work using past test runtimes.
- Fixture locality. Keeps tests with shared fixtures together unless splitting them is predicted to be faster.
- Dynamic rebalancing. Redistributes queued work as workers become available.
- Less collection work. Reuses worker collection results in the controller.
Bistra is early-stage software: expect bugs and breaking changes. Issues and PRs are welcome. See CONTRIBUTING.md to get started.