rpytest
July 2, 2026 · View on GitHub
Run your pytest suite faster. Change nothing.
rpytest is a Rust-powered, drop-in replacement for pytest that eliminates startup and collection overhead while keeping your existing tests, fixtures, and plugins completely untouched.
Website · Documentation · GitHub
# Install and run - that's it
pip install rpytest
rpytest
Why rpytest?
| Metric | pytest | rpytest | Improvement |
|---|---|---|---|
| Wall clock (480 tests) | 2.91s | 1.55s | 1.9x faster |
| CLI memory usage | 35.8 MB | 6.2 MB | 5.8x less |
The speed comes from a persistent daemon that keeps Python warm between runs. No more paying interpreter startup costs on every invocation.
Installation
# Via pip (recommended)
pip install rpytest
# Via Homebrew (macOS / Linux)
brew tap neul-labs/tap
brew install rpytest
# Via npm
npm install -g rpytest
# Via cargo (installs both the CLI and the daemon)
cargo install rpytest rpytest-daemon
# From source
git clone https://github.com/neul-labs/rpytest.git
cd rpytest
cargo install --path crates/rpytest
cargo install --path crates/rpytest-daemon
Note: rpytest requires the
rpytest-daemonbinary to function. Both packages must be installed when usingcargo install.
Usage
rpytest mirrors pytest's CLI exactly. If you know pytest, you know rpytest.
# Run all tests
rpytest
# Run specific tests
rpytest tests/test_api.py::test_login
# Filter by keyword or marker
rpytest -k "auth" -m "not slow"
# Parallel execution (pytest-xdist compatible, no plugin needed)
rpytest -n auto
# Watch mode for TDD
rpytest --watch
# Verify identical behavior to pytest
rpytest --verify-dropin
Key Features
Instant Startup
The first run spawns a background daemon. Every subsequent run is a fast RPC call—no interpreter startup, no re-importing your test modules.
Full pytest Compatibility
- All pytest CLI flags work identically
- Your plugins, fixtures, and conftest.py files run unchanged
pytest.ini,pyproject.toml, andtox.iniconfigs are respected- Exit codes and JUnit XML match pytest exactly
Built-in Parallelism
rpytest -n 4 # Run on 4 workers
rpytest -n auto # Auto-detect based on CPU cores
No pytest-xdist required. Duration-aware load balancing included.
Watch Mode
rpytest --watch
File changes trigger automatic re-runs of affected tests.
Flakiness Detection
rpytest --reruns 3 # Auto-retry failed tests
rpytest --flaky-report # See which tests are flaky
Sharding for CI
rpytest --shard 0 --total-shards 4 # Perfect for parallel CI jobs
How It Works
- First run: Spawns a Python daemon that collects your test suite once
- Subsequent runs: Rust CLI filters tests and dispatches to warm Python workers
- Results stream back in real-time for instant feedback
The daemon persists between runs, so repeated invocations (TDD loops, CI retries, --last-failed) skip all the startup work.
Daemon Management
rpytest --daemon-status # Check health
rpytest --daemon-stop # Stop the daemon
rpytest --cleanup # Clean stale contexts
Drop-in Guarantee
Run the verification harness to confirm identical behavior:
rpytest --verify-dropin
This runs both pytest and rpytest on your suite and compares collection counts, pass/fail results, and exit codes.
Configuration
rpytest reads your existing pytest configuration—no new config files needed:
pytest.inipyproject.toml([tool.pytest.ini_options])tox.inisetup.cfg
Documentation
Full documentation at docs.neullabs.com/rpytest
Contributing
Contributions welcome!
git clone https://github.com/neul-labs/rpytest.git
cd rpytest
cargo build
cargo test
Part of the Neul Labs toolchain
Explore the rest of the Neul Labs developer tools:
| Project | Description |
|---|---|
| rjest | A blazing-fast, Jest-compatible test runner — 100x faster warm runs. |
| rninja | Drop-in Ninja replacement with built-in caching. |
| gity | Make large Git repositories feel instant. |
| stkd | Stacked diffs for GitHub and GitLab. |
| grite | The issue tracker that lives in your repo. Built for AI agents. |
Learn more at neullabs.com.
License
Licensed under the MIT License.