Skip to content

Commit

Permalink
0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Hallett committed Sep 26, 2023
1 parent e9d2b68 commit 02e01ef
Show file tree
Hide file tree
Showing 20 changed files with 591 additions and 522 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change log

## 0.6.1

* Added `from __future__ import annotations` in files to help with typing evaluation.
* Update to use pydantic 2.4.
* A bunch of documentation and readme updates.
* Small wording and grammar fixes.

## 0.6.0

* Significantly improved handling for response schemas. Responses from API endpoints now look at the HTTP status code to pick the correct response schema to generate from the HTTP json data. When regenerating, you will notice a bit more logic generated in the `http.py` file to handle this.
Expand Down
69 changes: 33 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<p align="center">
<h1>⚜️ Clientele</h1>
<em>Loveable API Clients from OpenAPI schemas</em>
<img src="https://github.com/phalt/clientele/blob/main/docs/clientele.jpeg?raw=true">
</p>

<p align="center">
<a href="https://pypi.org/project/clientele" target="_blank">
<img src="https://img.shields.io/pypi/v/clientele?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://pypi.org/project/clientele" target="_blank">
<img src="https://img.shields.io/pypi/pyversions/clientele.svg?color=%2334D058" alt="Supported Python versions">
</a>
</p>

Clientele lets you generate fully-typed, loveable Python API Clients from OpenAPI schemas:
# ⚜️ Clientele

## Generate loveable Python HTTP API Clients

[![Package version](https://img.shields.io/pypi/v/clientele?color=%2334D058&label=latest%20version)](https://pypi.org/project/clientele)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/clientele?label=python%20support)
![PyPI - Downloads](https://img.shields.io/pypi/dm/clientele)
![PyPI - License](https://img.shields.io/pypi/l/clientele)

Clientele lets you generate fully-typed, pythonic HTTP API Clients using an OpenAPI schema.

It's easy to use:

```sh
# Install as a global tool - it's not a dependency!
pipx install clientele
# Generate a client
clientele generate -u https://raw.githubusercontent.com/phalt/clientele/main/example_openapi_specs/best.json -o api_client/
```

## Generated code

The generated code is designed by python developers, for python developers.

It uses modern tooling and has a great developer experience.

```py
from my_api import client, schemas

# Pydantic-typed inputs
# Pydantic models for inputs and outputs
data = schemas.RequestDataRequest(my_input="test")

# Easy to read client functions
Expand All @@ -36,7 +45,9 @@ match response:

The generated code is tiny - the [example schema](https://github.com/phalt/clientele/blob/0.4.4/example_openapi_specs/best.json) we use for documentation and testing only requires [250 lines of code](https://github.com/phalt/clientele/tree/0.4.4/tests/test_client) and 5 files.

Choose either sync or async - we support both, and you can switch between them easily:
## Async support

You can choose to generate either a sync or an async client - we support both:

```py
from my_async_api import client
Expand All @@ -45,25 +56,11 @@ from my_async_api import client
response = await client.simple_request_simple_request_get()
```

All generated from a single command:

```sh
# add -asyncio -t to make it async
clientele generate -u https://raw.githubusercontent.com/phalt/clientele/main/example_openapi_specs/best.json -o api_client/
```

(That works - try it now!)

## Other features

* Supports authentication automatically (curently only HTTP Bearer and HTTP Basic auth).
* Written entirely in Python - no need to install any other languages.
* The client footprint only requires `httpx` and `pydantic`.
* Written entirely in Python.
* The generated client only depends on [httpx](https://www.python-httpx.org/) and [Pydantic 2.4](https://docs.pydantic.dev/latest/).
* HTTP Basic and HTTP Bearer authentication support.
* Support your own configuration - we provide an entry point that will never be overwritten.
* Designed for easy testing with [respx](https://lundberg.github.io/respx/).

We're built on:

* [Pydantic 2.0](https://docs.pydantic.dev/latest/)
* [httpx](https://www.python-httpx.org/)
* [openapi-core](https://openapi-core.readthedocs.io/en/latest/)
* API updated? Just run the same command again and check the git diff.
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change log

## 0.6.1

* Added `from __future__ import annotations` in files to help with typing evaluation.
* Update to use pydantic 2.4.
* A bunch of documentation and readme updates.
* Small wording and grammar fixes.

## 0.6.0

* Significantly improved handling for response schemas. Responses from API endpoints now look at the HTTP status code to pick the correct response schema to generate from the HTTP json data. When regenerating, you will notice a bit more logic generated in the `http.py` file to handle this.
Expand Down
71 changes: 33 additions & 38 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
<p align="center">
<h1>⚜️ Clientele</h1>
<em>Loveable API Clients from OpenAPI schemas</em>
<img src="https://github.com/phalt/clientele/blob/main/docs/clientele.jpeg?raw=true">
</p>

<p align="center">
<a href="https://pypi.org/project/clientele" target="_blank">
<img src="https://img.shields.io/pypi/v/clientele?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://pypi.org/project/clientele" target="_blank">
<img src="https://img.shields.io/pypi/pyversions/clientele.svg?color=%2334D058" alt="Supported Python versions">
</a>
</p>

Clientele lets you generate fully-typed, loveable Python API Clients from OpenAPI schemas:
# ⚜️ Clientele

## Generate loveable Python HTTP API Clients

[![Package version](https://img.shields.io/pypi/v/clientele?color=%2334D058&label=latest%20version)](https://pypi.org/project/clientele)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/clientele?label=python%20support)
![PyPI - Downloads](https://img.shields.io/pypi/dm/clientele)
![PyPI - License](https://img.shields.io/pypi/l/clientele)

Clientele lets you generate fully-typed, pythonic HTTP API Clients using an OpenAPI schema.

It's easy to use:

```sh
# Install as a global tool - it's not a dependency!
pipx install clientele
# Generate a client
clientele generate -u https://raw.githubusercontent.com/phalt/clientele/main/example_openapi_specs/best.json -o api_client/
```

## Generated code

The generated code is designed by python developers, for python developers.

It uses modern tooling and has a great developer experience.

```py
from my_api import client, schemas

# Pydantic-typed inputs
# Pydantic models for inputs and outputs
data = schemas.RequestDataRequest(my_input="test")

# Easy to read client functions
Expand All @@ -36,7 +45,9 @@ match response:

The generated code is tiny - the [example schema](https://github.com/phalt/clientele/blob/0.4.4/example_openapi_specs/best.json) we use for documentation and testing only requires [250 lines of code](https://github.com/phalt/clientele/tree/0.4.4/tests/test_client) and 5 files.

Choose either sync or async - we support both, and you can switch between them easily:
## Async support

You can choose to generate either a sync or an async client - we support both:

```py
from my_async_api import client
Expand All @@ -45,27 +56,11 @@ from my_async_api import client
response = await client.simple_request_simple_request_get()
```

All generated from a single command:

```sh
# add -asyncio -t to make it async
clientele generate -u https://raw.githubusercontent.com/phalt/clientele/main/example_openapi_specs/best.json -o api_client/
```

!!! note

That line will generate an example client, why not give it a try now?

## Other features

* Supports authentication automatically (curently only HTTP Bearer and HTTP Basic auth).
* Written entirely in Python - no need to install any other languages.
* The client footprint only requires `httpx` and `pydantic`.
* Written entirely in Python.
* The generated client only depends on [httpx](https://www.python-httpx.org/) and [Pydantic 2.4](https://docs.pydantic.dev/latest/).
* HTTP Basic and HTTP Bearer authentication support.
* Support your own configuration - we provide an entry point that will never be overwritten.
* Designed for easy testing with [respx](https://lundberg.github.io/respx/).

We're built on:

* [Pydantic 2.0](https://docs.pydantic.dev/latest/)
* [httpx](https://www.python-httpx.org/)
* [openapi-core](https://openapi-core.readthedocs.io/en/latest/)
* API updated? Just run the same command again and check the git diff.
Loading

0 comments on commit 02e01ef

Please sign in to comment.