Metadata-Version: 2.5
Name: mite
Version: 3.0.0
Summary: A Python Performance Testing Framework
Project-URL: Homepage, https://github.com/sky-uk/mite/
Project-URL: Documentation, https://sky-uk.github.io/mite/
Project-URL: Repository, https://github.com/sky-uk/mite/
Project-URL: Issues, https://github.com/sky-uk/mite/issues
Author-email: Sky UK <mite@sky.uk>
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: <3.14,>=3.10
Requires-Dist: aio-pika>=10.0
Requires-Dist: aiokafka>=0.12
Requires-Dist: boto3>=1.35
Requires-Dist: bs4>=0.0.2
Requires-Dist: docopt>=0.6
Requires-Dist: flask>=3.0
Requires-Dist: httpperf==1.0rc8
Requires-Dist: jinja2>=3.1
Requires-Dist: msgpack>=1.0
Requires-Dist: nanomsg>=1.0
Requires-Dist: packaging>=22
Requires-Dist: prettytable>=3.10
Requires-Dist: pyzmq>=26.0
Requires-Dist: selenium-wire==4.6.5
Requires-Dist: selenium<4,>=3.141
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: thrift>=0.20
Requires-Dist: ujson>=5.10
Requires-Dist: uvloop>=0.21.0
Requires-Dist: websockets>=13
Provides-Extra: all
Requires-Dist: aio-pika; extra == 'all'
Requires-Dist: aiokafka; extra == 'all'
Requires-Dist: boto3; extra == 'all'
Requires-Dist: bs4; extra == 'all'
Requires-Dist: httpperf==1.0rc8; extra == 'all'
Requires-Dist: selenium-wire==4.6.5; extra == 'all'
Requires-Dist: selenium<4,>=3.141; extra == 'all'
Requires-Dist: sqlalchemy; extra == 'all'
Requires-Dist: thrift; extra == 'all'
Requires-Dist: websockets; extra == 'all'
Provides-Extra: amqp
Requires-Dist: aio-pika; extra == 'amqp'
Provides-Extra: browser
Requires-Dist: bs4; extra == 'browser'
Requires-Dist: httpperf==1.0rc8; extra == 'browser'
Provides-Extra: db
Requires-Dist: sqlalchemy; extra == 'db'
Provides-Extra: dev
Requires-Dist: httpbin>=0.10.2; extra == 'dev'
Requires-Dist: hypothesis; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest-httpbin; extra == 'dev'
Requires-Dist: pytest-httpserver; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: werkzeug==3.1.3; extra == 'dev'
Provides-Extra: docs
Requires-Dist: furo; extra == 'docs'
Requires-Dist: myst-parser; extra == 'docs'
Requires-Dist: sphinx; extra == 'docs'
Provides-Extra: finagle
Requires-Dist: thrift; extra == 'finagle'
Provides-Extra: http
Requires-Dist: httpperf==1.0rc8; extra == 'http'
Provides-Extra: influxdb
Requires-Dist: influxdb-client; extra == 'influxdb'
Requires-Dist: influxdb3-python; extra == 'influxdb'
Provides-Extra: kafka
Requires-Dist: aiokafka; extra == 'kafka'
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.20.0; extra == 'otel'
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20.0; extra == 'otel'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.20.0; extra == 'otel'
Requires-Dist: opentelemetry-exporter-zipkin>=1.20.0; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'otel'
Provides-Extra: s3
Requires-Dist: boto3; extra == 's3'
Provides-Extra: selenium
Requires-Dist: selenium<4,>=3.141; extra == 'selenium'
Provides-Extra: selenium-wire
Requires-Dist: selenium-wire==4.6.5; extra == 'selenium-wire'
Requires-Dist: selenium<4,>=3.141; extra == 'selenium-wire'
Provides-Extra: websocket
Requires-Dist: websockets; extra == 'websocket'
Description-Content-Type: text/markdown

# Mite


<div align="center">

<!-- <img src="https://raw.githubusercontent.com/sky-uk/mite/refs/heads/master/docs/_static/logo.png" alt="Mite logo" width="100" role="img"> -->

[![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/) [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3110/) [![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3120/) [![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org/downloads/release/python-3130/) [![Docs](https://img.shields.io/badge/docs-read-blue)](https://sky-uk.github.io/mite/)

[![Hatch project](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pypa/hatch/master/docs/assets/badge/v0.json)](https://github.com/pypa/hatch) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) [![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/sky-uk/mite/blob/master/LICENSE) 

</div>

-----


## Load Testing Framework

Mite is a load testing framework with distributed components written in Python.
Requests are executed asynchronously, allowing large throughput from relatively small infrastructure.

## Installation

```bash
pip install mite
```


This requires that you have libcurl installed on your system (including C header files for development, which are often distributed separately from the shared libraries).  On Ubuntu, this can be accomplished with the command:

```
sudo apt install libcurl4 libcurl4-openssl-dev
```
(NB we use a version of libcurl linked against openssl rather than
gnutls. This was originally because gnutls had high memory usage; that
issue has since been resolved, so use whichever you prefer)


You can also use the dockerfile included in this repository to run
mite.  In order to get a shell in a container with mite installed, run
these commands (assuming you have docker installed on your machine):
```
docker build -t mite .
docker run --rm -it mite sh
```

Run `mite --help` for a full list of commands

### Optional install extras

`pip install mite` already installs every integration mite ships. The extras
below are installable labels only, added ahead of a future major release that
will actually make them optional. Today, installing any of them (or none)
installs exactly the same packages:

| Extra | Covers |
|---|---|
| `kafka` | Kafka integration (`aiokafka`) |
| `amqp` | AMQP/RabbitMQ integration (`aio_pika`) |
| `finagle` | Finagle/Thrift integration (`thrift`) |
| `selenium` | Selenium WebDriver integration |
| `selenium_wire` | Selenium with request/response capture (`selenium-wire`) |
| `s3` | S3-backed datapools (`boto3`) |
| `db` | SQL-backed datapools (`sqlalchemy`) |
| `websocket` | WebSocket integration |
| `http` | HTTP integration (`httpperf`) |
| `browser` | Browser/HTML-scraping integration (depends on `http`) |
| `all` | Union of the above |

```bash
pip install 'mite[kafka]'
pip install 'mite[all]'
```

(quote the brackets so your shell doesn't treat them as a glob)

This list doesn't include `playwright`, `otel`, `influxdb`, or `dev`;
`playwright` needs a separate `playwright install` step to download browser
binaries so it isn't installed by any extra; `otel`, `influxdb`, and `dev` are
separate, pre-existing extras unrelated to this list. **Every extra above is
currently a functional no-op**: all of their packages are still in `mite`'s
mandatory dependency list, so
`pip install 'mite[kafka]'` installs exactly what `pip install mite` installs.
They only become meaningful once a future major release actually removes
packages from the default install.

## Your first scenario

A scenario combines three things: a set of journeys to run, a datapool
supplying test data to those journeys (if applicable), and a volume model
describing how much load to apply.

A journey is an async python function holding the logic of what you want to
do:

```python
import asyncio

async def journey(ctx, arg1, arg2):
    async with ctx.transaction('test1'):
        ctx.send('test_message', content=ctx.config.get('test_msg', 'Not set'), sum=arg1 + arg2)
        await asyncio.sleep(0.5)
```

A datapool supplies the journey's arguments, and a volume model says how many
copies of it to run in a given window of time:

```python
from mite.datapools import RecyclableIterableDataPool

datapool = RecyclableIterableDataPool([(i, i+2) for i in range(5000)])
volumemodel = lambda start, end: 10
```

A scenario packages them together:

```python
def scenario():
    return [
        ['mite.example:journey', datapool, volumemodel],
    ]
```

Test the journey on its own first, then run the whole scenario:

```sh
MITE_CONF_test_msg="Hello from mite" mite journey test mite.example:journey mite.example:datapool
MITE_CONF_test_msg="Hello from mite" mite scenario test mite.example:scenario
```

The full walkthrough — the journey context, custom datapools, debugging with
`--debugging`, and the volume model DSL — is in
[Your first scenario](https://sky-uk.github.io/mite/tutorial.html) in the
documentation.

## Distributed deployments

In order to scale up miteʼs capability to inject load, you will need to
run it as a distributed suite of components.  You can learn more about
how to accomplish this in the [documentation](https://sky-uk.github.io/mite/design-deployment.html).


### Deploy distributed mite with docker compose

Build mite image: 
```
docker build -t mite .
````

Run mite deployments:

Use `make` from `mite/local` dir:
```
make up # start mite containers
make status # check status of mite containers
make clean # remove all mite containers
```
or
```
docker-compose -f docker_compose.yml up
```

For more information on distributed mite usage, [info](/local/README.md)

## Maintainers

If you run into any trouble or need support getting to grips with Mite,
reach out on [Slack](https://sky.slack.com/messages/mite) if you work at Sky,
 or contact one of the maintainers if you're an external contributer:

| [<img src="https://avatars.githubusercontent.com/jb098" width=100 height=100 alt="Jordan Brennan" /><br />Jordan Brennan](https://github.com/jb098)<br /><sub>💻</sub> | [<img src="https://avatars.githubusercontent.com/aecay" width=100 height=100 alt="Aaron Ecay" /> <br />Aaron Ecay](https://github.com/aecay)<br /><sub>💻</sub> | [<img src="https://avatars.githubusercontent.com/DavAnnunz" width=100 height=100 alt="Davide Annunziata" /><br />Davide Annunziata](https://github.com/DavAnnunz)<br /><sub>💻</sub> | [<img src="https://avatars.githubusercontent.com/ryanlinnit-sky" width=100 height=100 alt="Ryan Linnit" /><br />Ryan Linnit](https://github.com/ryanlinnit-sky)<br /><sub>💻</sub> |
| :---: | :---: | :---: | :---: |

**Special thanks to the following contributors:**

* [Tony Simpson](https://github.com/tonysimpson)
