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.tar.gz (71.6 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-cp314-cp314-manylinux_2_34_x86_64.whl (371.9 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

File details

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

File metadata

  • Download URL: rampa-0.0.1a1.tar.gz
  • Upload date:
  • Size: 71.6 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.tar.gz
Algorithm Hash digest
SHA256 f63b8fb40ceef4b92211b96ecaef0495f216f11c620f9b30225215b809f1d587
MD5 f83cfde5ebc341c8a7c2bd4d5c854681
BLAKE2b-256 c162ac3178d20316d13a9385ca0bde81b134a47cd10ac3d3a9645e41b50dd340

See more details on using hashes here.

Provenance

The following attestation bundles were made for rampa-0.0.1a1.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-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for rampa-0.0.1a1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a812cb0086f44aa85d9d1fd04aa76dcd61f63a04253f2b95ddc8f9996f4f148d
MD5 4eab704e32da686062c991124d2eb126
BLAKE2b-256 ec1343da9e3bef942e3d4973a984175ce9a67429b942638e4497f1b5bc2756f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for rampa-0.0.1a1-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