Skip to main content

High Performance Test Engine - Rust + Python

Project description

TurboPlex (tpx) — Fast Test Orchestration for Python (Rust core)

English | Español

Rust Python License

TurboPlex is a hybrid Rust + Python test runner that accelerates large suites with:

  • fast test discovery
  • parallel execution
  • SHA-based caching
  • structured JSON reports for IDEs and AI agents

TL;DR

pip install turboplex
tpx --path tests/

Contents

Why TurboPlex?

TurboPlex focuses on making “run tests” fast and machine-consumable:

Feature What you get
Fast discovery AST-based collection avoids heavy imports where possible
Parallel execution Isolated Python subprocess per test (or pytest in compat mode)
Smart caching Cache pass results keyed by file hash + runtime fingerprint
Structured output Stable JSON schema for tooling, MCP, and analysis
Watch mode Rerun suite on file save

Installation

From PyPI:

pip install turboplex
tpx --help

From source (dev):

git clone https://github.com/IzumiKeita/turboplex.git
cd turboplex
pip install -e .
tpx --help

Quick Start

Run a directory:

tpx --path tests/

Run multiple paths:

tpx --path tests/ --path tests/integration/

Auto-discover:

tpx

Watch mode:

tpx --watch --path tests/

Modes

Native mode (default)

Best for suites where:

  • imports can be expensive (DB bootstraps, migrations, Pydantic config)
  • you want faster iteration with caching and structured results

Pytest compatibility mode (--compat)

Use this when you need full pytest semantics/plugins:

tpx --compat --path tests/

Light collect (--light)

Skips conftest.py import during discovery. Useful when conftest.py performs heavy work on import.

tpx --compat --light

Environment alternative:

export TPX_MCP_LIGHT_COLLECT=1  # Linux/Mac
set TPX_MCP_LIGHT_COLLECT=1     # Windows

Windows / venv (TPX_PYTHON_EXE)

TurboPlex resolves the Python interpreter using this precedence:

  1. TPX_PYTHON_EXE (if set and path exists)
  2. python.interpreter from turbo_config.toml (if set and path exists)
  3. Auto-detected .venv/venv/.env/env near the project
  4. System python

Example (force a secondary venv):

$env:TPX_PYTHON_EXE = (Resolve-Path .\.venv_alt\Scripts\python.exe).Path
tpx --path tests/

CLI prints a confirmation line:

  • Using TPX_PYTHON_EXE: C:\path\to\.venv_alt\Scripts\python.exe

Skipping tests (pytest.skip)

In native mode, pytest.skip(...) is recognized and reported as a skip (not a failure):

  • CLI prints SKIP ... lines
  • summary includes skipped
  • JSON includes skipped: true and skip_reason

Example summary:

Results: 120 passed, 0 failed, 5 skipped (24000ms)

Reports

TurboPlex generates machine-readable artifacts:

  • .tplex_report.json and timestamped .tplex_report_%Y%m%d_%H%M%S.json
  • turboplex_full_report.json (JSONL) with richer error context for large suites

Cache

Cache lives in .turboplex_cache/ and is invalidated when:

  • test files change (hash)
  • runtime fingerprint changes (Python version, deps hash, PYTHONPATH, flags)

MCP server (IDE integration)

Start the MCP server:

tpx mcp

Notes:

  • --out-json avoids stdout pollution for JSON-RPC toolchains.
  • subprocesses force UTF-8 (PYTHONUTF8=1, PYTHONIOENCODING=utf-8, PYTHONUNBUFFERED=1).

Common MCP env vars:

  • TPX_PYTHON_EXE
  • TPX_MCP_LIGHT_COLLECT=1
  • TPX_MCP_DEBUG=1
  • TPX_MCP_STDOUT_MODE=redirect|failfast
  • TPX_MCP_TURBOPLEX_COLLECT_TIMEOUT_S (default 120)
  • TPX_MCP_TURBOPLEX_RUN_TIMEOUT_S (default 60)
  • TPX_MCP_PYTEST_COLLECT_TIMEOUT_S / TPX_PYTEST_COLLECT_TIMEOUT_S (default 120)
  • TPX_MCP_PYTEST_RUN_TIMEOUT_S / TPX_PYTEST_RUN_TIMEOUT_S (default 60)

Example MCP config:

{
  "mcpServers": {
    "tpx": {
      "command": "tpx",
      "args": ["mcp"],
      "env": {
        "TPX_PYTHON_EXE": "/path/to/venv/bin/python",
        "TPX_MCP_LIGHT_COLLECT": "1",
        "TPX_MCP_DEBUG": "1"
      }
    }
  }
}

Configuration

turbo_config.toml example:

[execution]
max_workers = 8
default_timeout_ms = 30000
cache_enabled = true

[python]
enabled = true
interpreter = "python"
module = "turboplex_py"
test_paths = ["tests"]
project_path = "."

Benchmarks

Production suite (~200 tests):

Tool Time per test
pytest ~340s ~1.7s
tpx (cold) ~180s ~0.9s
tpx (cached) ~25s ~0.13s

Troubleshooting

Common issues:

  • “Fixture not found” in native mode
    • Use --compat if you rely on complex pytest fixtures/plugins
  • Slow discovery
    • Use --light (or TPX_MCP_LIGHT_COLLECT=1) to avoid heavy conftest imports
  • “ModuleNotFoundError” during run
    • Ensure your project is on PYTHONPATH or configured via turbo_config.toml

Development

Build wheels with maturin:

python -m pip install maturin
python -m maturin build --release -o dist
python -m maturin sdist -o dist

License

MIT License — see LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

turboplex-0.3.1.tar.gz (231.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

turboplex-0.3.1-py3-none-win_amd64.whl (916.1 kB view details)

Uploaded Python 3Windows x86-64

File details

Details for the file turboplex-0.3.1.tar.gz.

File metadata

  • Download URL: turboplex-0.3.1.tar.gz
  • Upload date:
  • Size: 231.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for turboplex-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a016e61f024d59e28eeba5eeaa8a60564f6e58ef8d2e3fff8cc56062d0a7cb2a
MD5 3590785aaad34dcc5caa4a70daf62a43
BLAKE2b-256 6feff17d758077d7715f9c417ec0e241ecbb1182ebdd516ac3c6507a8b4bd281

See more details on using hashes here.

File details

Details for the file turboplex-0.3.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: turboplex-0.3.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 916.1 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for turboplex-0.3.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2e0e275c40fafc53eb79d12a8da31e395337f5c1172ef4073c22e41185ee89c1
MD5 c22ecb59f10a0bb96b00cd40754bb671
BLAKE2b-256 48104acff124dcd2c9b43473b62af380956fb3485b61df272125f8ef5882d6e6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page