A clean utility tool to convert OpenAPI specs directly into locustfiles
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file locust_openapi_generator-0.1.1.tar.gz.
File metadata
- Download URL: locust_openapi_generator-0.1.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
765b271365d2308760ec53225ba6471b7a9567c72734fd239009f45f4bf871f9
|
|
| MD5 |
dd30349b88d4741c45677e215781bb4e
|
|
| BLAKE2b-256 |
9bfeab06a54df2e7f52fb9538d483d1007a97050174c8ffebb185964f45032fd
|
Provenance
The following attestation bundles were made for locust_openapi_generator-0.1.1.tar.gz:
Publisher:
publish.yml on FallenAngel97/locust-openapi-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
locust_openapi_generator-0.1.1.tar.gz -
Subject digest:
765b271365d2308760ec53225ba6471b7a9567c72734fd239009f45f4bf871f9 - Sigstore transparency entry: 2148335511
- Sigstore integration time:
-
Permalink:
FallenAngel97/locust-openapi-generator@3fd949bd6d187d55b3d41ad8605739f6dfa4d1bb -
Branch / Tag:
refs/heads/master - Owner: https://github.com/FallenAngel97
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3fd949bd6d187d55b3d41ad8605739f6dfa4d1bb -
Trigger Event:
push
-
Statement type:
File details
Details for the file locust_openapi_generator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: locust_openapi_generator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7688442fefe02685ebed3be7cfc67e8baf7a77b5ba0d12deaab80b30bfdbaab6
|
|
| MD5 |
5849a794c819a6726be230339c7031be
|
|
| BLAKE2b-256 |
e738a98f05afbe3249f7d0edc1af5d6ba96bfae982b55a180025a9054d1523b0
|
Provenance
The following attestation bundles were made for locust_openapi_generator-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on FallenAngel97/locust-openapi-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
locust_openapi_generator-0.1.1-py3-none-any.whl -
Subject digest:
7688442fefe02685ebed3be7cfc67e8baf7a77b5ba0d12deaab80b30bfdbaab6 - Sigstore transparency entry: 2148335524
- Sigstore integration time:
-
Permalink:
FallenAngel97/locust-openapi-generator@3fd949bd6d187d55b3d41ad8605739f6dfa4d1bb -
Branch / Tag:
refs/heads/master - Owner: https://github.com/FallenAngel97
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3fd949bd6d187d55b3d41ad8605739f6dfa4d1bb -
Trigger Event:
push
-
Statement type: