OpenAPI to Locust Generator
A lightweight command-line utility that parses an OpenAPI specification (Swagger/OAS 3.0) and generates a clean, PEP8-compliant locustfile.py with auto-mocked query parameters and JSON request bodies.
Features
- Robust OpenAPI Parsing: Uses
pranceto resolve internal$reflinks and complex structural schemas. - Payload & Parameter Mocking: Automatically creates mock data structures based on property types (
uuid,date-time, arrays, etc.) forGET,POST,PUT, andPATCHrequests. - Syntax Isolation: Automatically sanitizes operation descriptions, handles punctuation gracefully, and eliminates template gaps.
Install
pip install locust-openapi-generator
locust-openapi-generator openapi.json
Local Installation & Setup
If you are developing locally on your laptop, follow these steps to isolate your dependencies and get started.
1. Clone the Repository
git clone [https://github.com/your-username/your-repo-name.git](https://github.com/your-username/your-repo-name.git)
cd your-repo-name
2. Create and Activate a Virtual Environment
Isolate your workspace packages using Python's built-in venv module.
On macOS/Linux:
python3 -m venv .venv
source .venv/bin/activate
On Windows (Command Prompt):
python -m venv .venv
.venv\Scripts\Activate
On Windows (PowerShell):
python -m venv .venv
.\.venv\Scripts\Activate.ps1
3. Install dependencies
Install the required tools directly via the requirements.txt manifest:
pip install --upgrade pip
pip install -r requirements.txt
Usage
You can run the script directly from your terminal by passing your OpenAPI JSON or YAML spec file.
Basic Generation
Generates a standard locustfile.py in your current directory:
python src/openapi_to_locust/generator.py path/to/openapi.json
Custom Output Name
Change the target filename using the -o or --output flag:
python src/openapi_to_locust/generator.py path/to/openapi.yaml -o dynamic_load_test.py
Powered by
Metadata
Release files for locust-openapi-generator 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| locust_openapi_generator-0.1.2.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| locust_openapi_generator-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.3 kB
Release files / locust_openapi_generator-0.1.2.tar.gz
| Download URL | locust_openapi_generator-0.1.2.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6498944bb7430834705595b087f7ae30a824d68ab1a1f623675ffd3e771387b6
|
|
BLAKE2b-256 checksum How to use checksums |
5d1ad00a8583956440ffa82700ed05f3b1b9aa62617bab1aff9ff90b22b4eb4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency logRelease files / locust_openapi_generator-0.1.2-py3-none-any.whl
| Download URL | locust_openapi_generator-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95a338e90bff73a42750e5d25063135368fb195a13401db1b4f3e8e182beed02
|
|
BLAKE2b-256 checksum How to use checksums |
89ac552a75ace24ba5c73d1dc4b745634f362cc01f1d04e89665ec0396352da7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 12, 2026.
Transparency log