Skip to main content

Load testing framework

Project description

rampa

Python versions License: MIT

A Python 3.14+ async load testing framework with headless engine, typed metrics, threshold policies, and six executor types matching k6's scheduling models.

Pre-alpha. APIs may change.

Installation

$ uv add rampa

Quick Start

Write a test script:

import rampa


@rampa.scenario(executor="constant-vus", vus=10, duration="30s")
async def default(worker: rampa.Worker) -> None:
    resp = await worker.http.get("https://test.k6.io")
    worker.check(resp, {
        "status is 200": lambda r: r.status == 200,
    })

Run it:

$ rampa run load_test.py

Full Example

import rampa
from rampa import Config, Scenario

config = Config(
    scenarios={
        "load": rampa.ScenarioConfig(
            executor="ramping-arrival-rate",
            rate=10.0,
            stages=[
                rampa.Stage(duration="1m", target=100),
            ],
            pre_allocated_vus=50,
            max_vus=200,
        ),
    },
    thresholds={
        "http_req_duration": ["p(95)<500"],
        "http_req_failed": ["rate<0.01"],
    },
)


async def setup() -> dict:
    return {"base_url": "https://staging.example.com"}


@rampa.scenario("load")
async def load_test(worker: rampa.Worker) -> None:
    resp = await worker.http.get(
        f"{worker.setup_data['base_url']}/api/users"
    )
    worker.check(resp, {
        "status is 200": lambda r: r.status == 200,
        "body has users": lambda r: len(r.json()["users"]) > 0,
    })

Headless Engine API

For programmatic use (pytest, TUI, MCP, CI):

import asyncio
import rampa

plan = rampa.loader.load_test("load_test.py")
controller = await rampa.Engine(plan).start()

# Poll metrics while running
snapshot = controller.snapshot()

# Or consume events
async for event in controller.events():
    print(event)

result = await controller.wait()
print(result.status)  # RunStatus.PASSED / THRESHOLD_FAILED / ...

CLI

$ rampa run script.py --vus 10 --duration 30s --out result.json

Exit codes: 0 = passed, 1 = threshold failed, 2 = iteration error, 3 = invalid config, 4 = aborted, 5 = setup failure.

Executors

Executor Model Description
constant-vus Closed Fixed N workers for a duration
ramping-vus Closed Linear VU ramp between stages
shared-iterations Closed N VUs share M total iterations
per-vu-iterations Closed Each VU runs exactly N iterations
constant-arrival-rate Open Timer-based scheduling, dropped iterations
ramping-arrival-rate Open Rate interpolation between stages

Links

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

rampa-0.0.1a1.dev0.tar.gz (71.5 kB view details)

Uploaded Source

Built Distribution

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

rampa-0.0.1a1.dev0-cp314-cp314-manylinux_2_34_x86_64.whl (371.0 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

File details

Details for the file rampa-0.0.1a1.dev0.tar.gz.

File metadata

  • Download URL: rampa-0.0.1a1.dev0.tar.gz
  • Upload date:
  • Size: 71.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rampa-0.0.1a1.dev0.tar.gz
Algorithm Hash digest
SHA256 3f396e21d859dd567bff80a063e5bc47c48288658f176d32924792d5c9959da1
MD5 aa693f26d1f915eeffac28cd78ad298c
BLAKE2b-256 8064f4724439af33c0e82fb2579eec7ef6c1527d4f44871173a6820c88e7dbab

See more details on using hashes here.

Provenance

The following attestation bundles were made for rampa-0.0.1a1.dev0.tar.gz:

Publisher: tests.yml on tony/rampa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rampa-0.0.1a1.dev0-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rampa-0.0.1a1.dev0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 f2387ca658a4646518cddc3413f473acda1a3150155cedc2fac9e92d657279df
MD5 c9e124117c7a49d8e0d51c33d568df92
BLAKE2b-256 7aa7a48b7d66504189c0a2a423a5789b713c4577ff4ca9a676f564151a59fd8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for rampa-0.0.1a1.dev0-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: tests.yml on tony/rampa

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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