# Borea Python HTTP Client SDK Generator
Please learn more about Borea and our mission at [borea.dev](https://borea.dev) and our organization on GitHub [Borea-dev](https://github.com/Borea-dev).
This repository contains a Python HTTP client SDK generator. It generates a Python client from an OpenAPI specification.
## Table of Contents
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Usage](#usage)
- [Running Tests](#running-tests)
- [Project Structure](#project-structure)
- [Manual Install](#manual-install)
- [License](#license)
## Getting Started <a id="getting-started"></a>
### Prerequisites
- Python 3.8 or higher
- pip (Python package installer)
### Installation <a id="installation"></a>
Available as [borea-python](https://pypi.org/project/borea-python/) on PyPI.
```bash
pip install borea-python
```
For info on cloning and installing manually read [**Manual Install**](#manual-install).
## Usage <a id="usage"></a>
### Running the Python SDK Generator
The SDK generator provides two main commands:
1. `init` - Creates a new `borea.config.json` configuration file
2. `generate` - Generates a Python SDK from an OpenAPI specification
If no command is specified, the help message will be displayed.
#### Initialize a new configuration file
```bash
python -m borea_python.cli init
```
This will create a new `borea.config.json` file in the current directory with default settings. If the file already exists, you will be prompted to confirm overwriting it.
#### Generate the SDK
```bash
python -m borea_python.cli generate [OPTIONS]
```
The generator will create the Python HTTP client SDK based on the OpenAPI specification.
### Configuration
**IMPORTANT!**
Command line arguments take precedence over settings in `borea.config.json`.
The project uses `borea.config.json` for configuration settings. Example config with the `defaults`:
```json
{
"input": {
"openapi": ["openapi.json"]
},
"output": {
"clientSDK": "Formatted OpenAPI Title by default",
"models": "models",
"tests": false,
"xCodeSamples": false
},
"ignores": []
}
```
- `input`: map input options to array of values, ordered by precedence. For example, first value is a file path and the second is a URL. If the file cannot be found, then the URL will be used.
- `output`: map output options to values
- `ignore`: array of `glob` patterns to ignore. No file or directory matching the pattern will be created.
### Command line help
```bash
python -m borea_python.cli generate --help
```
Output:
```
Usage: python -m borea_python.cli generate [OPTIONS]
Generate a Python SDK from an OpenAPI specification.
The OpenAPI specification can be provided as a local file path or a URL. For
URLs, both JSON and YAML formats are supported.
Options:
-i, --openapi-input TEXT Path to OpenAPI specification file or URL
-o, --sdk-output TEXT Output directory for the generated SDK
-m, --models-output TEXT Output directory for the generated models
-t, --tests TEXT Generate tests
-x, --x-code-samples TEXT Generate x-code-samples
-c, --config TEXT Path to borea.config.json
--help Show this message and exit.
```
## Running Tests <a id="running-tests"></a>
**To be implemented...**
To run the test suite:
```bash
python -m pytest
```
## Project Structure <a id="project-structure"></a>
- `src/` - Contains the source code for the SDK generator
- `openapi.json` - OpenAPI specification file or wherever you decide to put it
- `borea.config.json` - Configuration file for the generator
- `.venv/` - Python virtual environment (created during setup)
## Manual Install <a id="manual-install"></a>
### Clone repo
```bash
git clone https://github.com/Borea-dev/python-client-generator.git
```
Run the automated setup script:
_`source` is required to activate the virtual environment_
```bash
source ./setup-venv.sh
```
This script will:
1. Create a Python virtual environment (`.venv`)
2. Activate the virtual environment
3. Install all required dependencies
Available options:
```bash
setup-venv.sh [OPTIONS]
Options:
-r, --recreate Recreate virtual environment (deletes existing .venv)
-i, --reinstall Reinstall all requirements
-h, --help Show this help message
```
## License <a id="license"></a>
This project is licensed under the terms specified in the LICENSE file.
Raw data
{
"_id": null,
"home_page": null,
"name": "borea-python",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "Borea, Client, Generator, OpenAPI",
"author": null,
"author_email": "David Bauch <pypi@borea.dev>",
"download_url": "https://files.pythonhosted.org/packages/10/c9/bbce5488495e867c9aae4082044b35981808995440d37340a50377828a6e/borea_python-1.1.2.tar.gz",
"platform": null,
"description": "# Borea Python HTTP Client SDK Generator\n\nPlease learn more about Borea and our mission at [borea.dev](https://borea.dev) and our organization on GitHub [Borea-dev](https://github.com/Borea-dev).\n\nThis repository contains a Python HTTP client SDK generator. It generates a Python client from an OpenAPI specification.\n\n## Table of Contents\n\n- [Getting Started](#getting-started)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Running Tests](#running-tests)\n- [Project Structure](#project-structure)\n- [Manual Install](#manual-install)\n- [License](#license)\n\n## Getting Started <a id=\"getting-started\"></a>\n\n### Prerequisites\n\n- Python 3.8 or higher\n- pip (Python package installer)\n\n### Installation <a id=\"installation\"></a>\n\nAvailable as [borea-python](https://pypi.org/project/borea-python/) on PyPI.\n\n```bash\npip install borea-python\n```\n\nFor info on cloning and installing manually read [**Manual Install**](#manual-install).\n\n## Usage <a id=\"usage\"></a>\n\n### Running the Python SDK Generator\n\nThe SDK generator provides two main commands:\n\n1. `init` - Creates a new `borea.config.json` configuration file\n2. `generate` - Generates a Python SDK from an OpenAPI specification\n\nIf no command is specified, the help message will be displayed.\n\n#### Initialize a new configuration file\n\n```bash\npython -m borea_python.cli init\n```\n\nThis will create a new `borea.config.json` file in the current directory with default settings. If the file already exists, you will be prompted to confirm overwriting it.\n\n#### Generate the SDK\n\n```bash\npython -m borea_python.cli generate [OPTIONS]\n```\n\nThe generator will create the Python HTTP client SDK based on the OpenAPI specification.\n\n### Configuration\n\n**IMPORTANT!**\n\nCommand line arguments take precedence over settings in `borea.config.json`.\n\nThe project uses `borea.config.json` for configuration settings. Example config with the `defaults`:\n\n```json\n{\n\t\"input\": {\n\t\t\"openapi\": [\"openapi.json\"]\n\t},\n\t\"output\": {\n\t\t\"clientSDK\": \"Formatted OpenAPI Title by default\",\n\t\t\"models\": \"models\",\n\t\t\"tests\": false,\n\t\t\"xCodeSamples\": false\n\t},\n\t\"ignores\": []\n}\n```\n\n- `input`: map input options to array of values, ordered by precedence. For example, first value is a file path and the second is a URL. If the file cannot be found, then the URL will be used.\n- `output`: map output options to values\n- `ignore`: array of `glob` patterns to ignore. No file or directory matching the pattern will be created.\n\n### Command line help\n\n```bash\npython -m borea_python.cli generate --help\n```\n\nOutput:\n\n```\nUsage: python -m borea_python.cli generate [OPTIONS]\n\n Generate a Python SDK from an OpenAPI specification.\n\n The OpenAPI specification can be provided as a local file path or a URL. For\n URLs, both JSON and YAML formats are supported.\n\nOptions:\n -i, --openapi-input TEXT Path to OpenAPI specification file or URL\n -o, --sdk-output TEXT Output directory for the generated SDK\n -m, --models-output TEXT Output directory for the generated models\n -t, --tests TEXT Generate tests\n -x, --x-code-samples TEXT Generate x-code-samples\n -c, --config TEXT Path to borea.config.json\n --help Show this message and exit.\n```\n\n## Running Tests <a id=\"running-tests\"></a>\n\n**To be implemented...**\n\nTo run the test suite:\n\n```bash\npython -m pytest\n```\n\n## Project Structure <a id=\"project-structure\"></a>\n\n- `src/` - Contains the source code for the SDK generator\n- `openapi.json` - OpenAPI specification file or wherever you decide to put it\n- `borea.config.json` - Configuration file for the generator\n- `.venv/` - Python virtual environment (created during setup)\n\n## Manual Install <a id=\"manual-install\"></a>\n\n### Clone repo\n\n```bash\ngit clone https://github.com/Borea-dev/python-client-generator.git\n```\n\nRun the automated setup script:\n\n_`source` is required to activate the virtual environment_\n\n```bash\nsource ./setup-venv.sh\n```\n\nThis script will:\n\n1. Create a Python virtual environment (`.venv`)\n2. Activate the virtual environment\n3. Install all required dependencies\n\nAvailable options:\n\n```bash\nsetup-venv.sh [OPTIONS]\n\nOptions:\n -r, --recreate Recreate virtual environment (deletes existing .venv)\n -i, --reinstall Reinstall all requirements\n -h, --help Show this help message\n```\n\n## License <a id=\"license\"></a>\n\nThis project is licensed under the terms specified in the LICENSE file.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate extensible python HTTP client from OpenAPI spec",
"version": "1.1.2",
"project_urls": {
"Homepage": "https://github.com/Borea-dev/python-client-generator",
"Issues": "https://github.com/Borea-dev/python-client-generator/issues"
},
"split_keywords": [
"borea",
" client",
" generator",
" openapi"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "019c0ba75dc77f84594510f3bf08ff109379e3f602d8dad497b0ecf0512cfb6c",
"md5": "4dc569cd4370c0198ac2b0662e6c444d",
"sha256": "f65d45045aea797fe0630b8331d69dd1b1747797ec0372bb0d357278a80655f5"
},
"downloads": -1,
"filename": "borea_python-1.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4dc569cd4370c0198ac2b0662e6c444d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 31801,
"upload_time": "2025-04-09T03:52:43",
"upload_time_iso_8601": "2025-04-09T03:52:43.280906Z",
"url": "https://files.pythonhosted.org/packages/01/9c/0ba75dc77f84594510f3bf08ff109379e3f602d8dad497b0ecf0512cfb6c/borea_python-1.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "10c9bbce5488495e867c9aae4082044b35981808995440d37340a50377828a6e",
"md5": "e720c2203a213efd1c7871c2865e197f",
"sha256": "6cc052718bd07bdbd7408298554e17fbfed83d1d81d082736100e33727a6add1"
},
"downloads": -1,
"filename": "borea_python-1.1.2.tar.gz",
"has_sig": false,
"md5_digest": "e720c2203a213efd1c7871c2865e197f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 27931,
"upload_time": "2025-04-09T03:52:44",
"upload_time_iso_8601": "2025-04-09T03:52:44.859888Z",
"url": "https://files.pythonhosted.org/packages/10/c9/bbce5488495e867c9aae4082044b35981808995440d37340a50377828a6e/borea_python-1.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-04-09 03:52:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Borea-dev",
"github_project": "python-client-generator",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "black",
"specs": [
[
">=",
"25.1.0"
]
]
},
{
"name": "httpx",
"specs": [
[
">=",
"0.28.1"
]
]
},
{
"name": "datamodel-code-generator",
"specs": [
[
">=",
"0.28.1"
]
]
},
{
"name": "pydantic",
"specs": [
[
">=",
"2.10.6"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
">=",
"4.12.2"
]
]
},
{
"name": "python-dateutil",
"specs": [
[
">=",
"2.9.0"
]
]
},
{
"name": "PyYAML",
"specs": [
[
">=",
"6.0.2"
]
]
},
{
"name": "click",
"specs": [
[
">=",
"8.1.8"
]
]
},
{
"name": "rich",
"specs": [
[
">=",
"13.9.4"
]
]
},
{
"name": "jinja2",
"specs": [
[
">=",
"3.1.5"
]
]
}
],
"lcname": "borea-python"
}