All updates can be found at: https://github.com/Borea-dev/python-client-generator
This repository contains a Python SDK generator. It generates a Python client library from an OpenAPI specification.
- Python 3.8 or higher
- pip (Python package installer)
Run the automated setup script:
./setup.sh
This script will:
- Create a Python virtual environment (
.venv
) - Activate the virtual environment
- Install all required dependencies
Available options:
./setup.sh [OPTIONS]
Options:
-r, --recreate Recreate virtual environment (deletes existing .venv)
-i, --reinstall Reinstall all requirements
-h, --help Show this help message
If you prefer to set up manually, follow these steps:
- Create a virtual environment:
python -m venv .venv
- Activate the virtual environment:
- On macOS/Linux:
source .venv/bin/activate
- On Windows:
.venv\Scripts\activate
- Install the package dependencies:
pip install -r src/requirements.txt
-
Ensure you have a valid OpenAPI specification file (
openapi.json
) in the root directory or provide the path via the--input
option or in thegenerator.input
setting inborea.config.json
. -
Run the SDK generator:
python -m src.python_sdk_generator.python_sdk_generator
- Show this help message with
--help
:
Usage: python -m src.python_sdk_generator.python_sdk_generator
[OPTIONS]
Generate a Python SDK from an OpenAPI specification.
Options:
--input PATH OpenAPI specification file (JSON or YAML)
-o, --sdk-output PATH Output directory for the generated SDK
--models-output PATH Output directory for generated models (default: <sdk-output>/models)
--tests BOOLEAN Generate tests (default: False)
--config TEXT Path to borea.config.json
--help Show this message and exit.
The generator will create the Python client library based on the OpenAPI specification.
The project uses borea.config.json
for configuration settings. The default configuration includes:
{
"generator": {
"input": "openapi.json",
"sdkOutput": "generated_sdk",
"modelsOutput": "models",
"tests": false
},
"ignores": []
}
You can modify this file to add specific patterns or files to ignore during the generation process. Any file or folders matching a glob pattern will not be created or overwritten.
You can also include the generation parameters.
To be implemented...
To run the test suite:
python -m pytest
src/
- Contains the source code for the SDK generatoropenapi.json
- OpenAPI specification file or wherever you decide to put itborea.config.json
- Configuration file for the generator.venv/
- Python virtual environment (created during setup)
This project is licensed under the terms specified in the LICENSE file.