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.1a0.tar.gz (210.3 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.1a0-py3-none-any.whl (51.5 kB view details)

Uploaded Python 3

File details

Details for the file rampa-0.0.1a0.tar.gz.

File metadata

  • Download URL: rampa-0.0.1a0.tar.gz
  • Upload date:
  • Size: 210.3 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.1a0.tar.gz
Algorithm Hash digest
SHA256 999de6222ee598b187b794307108a36e653efe2a82fddcf8f47004157e6bc479
MD5 a7eadbb3a84a9accf10a875460f660cf
BLAKE2b-256 aafaacd03dccec6c2e372693e46049ba699d8cca40c1fdf4b0d5eb8b669cd8fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for rampa-0.0.1a0.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.1a0-py3-none-any.whl.

File metadata

  • Download URL: rampa-0.0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 51.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rampa-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 930e55ab8b3f2892b727ff769de8586e87ddee25140df1c851793c7569a059d0
MD5 a7969eb179f8d8170dc131b9543ea7c8
BLAKE2b-256 760124d59fb9b4782ccfd0d4d30a2fccaf75ce2b6484ceff66b6d3d069b996be

See more details on using hashes here.

Provenance

The following attestation bundles were made for rampa-0.0.1a0-py3-none-any.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