https://github.com/python-lapidary/lapidary
Write Web API clients using annotations in python
https://github.com/python-lapidary/lapidary
api-client declarative-language declarative-library declarative-programming domain-specific-language dsl openapi openapi3 python python3
Last synced: 17 days ago
JSON representation
Write Web API clients using annotations in python
- Host: GitHub
- URL: https://github.com/python-lapidary/lapidary
- Owner: python-lapidary
- License: mit
- Created: 2022-08-30T19:50:12.000Z (over 3 years ago)
- Default Branch: develop
- Last Pushed: 2026-03-28T13:03:11.000Z (26 days ago)
- Last Synced: 2026-03-28T16:25:46.401Z (26 days ago)
- Topics: api-client, declarative-language, declarative-library, declarative-programming, domain-specific-language, dsl, openapi, openapi3, python, python3
- Language: Python
- Homepage: https://lapidary.dev/lapidary-runtime/
- Size: 874 KB
- Stars: 16
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: Readme.md
- Changelog: ChangeLog.md
- License: License.txt
Awesome Lists containing this project
README
# Lapidary
[](https://github.com/python-lapidary/lapidary/actions/workflows/test_publish.yaml)
Python Helper for Web API clients.
## Why
Web API clients follow a relatively small set of patterns and implementing them is rather repetitive task.
Prepare request, make the call, handle response status, deserialize the body
Typical examples show how to use `request.get()` or similar method, but this is an anti-pattern. These calls should be encapsulated as module functions or methods.
## How
Lapidary is a library that provides decorators and annotations for describing Web APIs in a way similar to OpenAPI.
In fact [lapidary render](https://github.com/python-lapidary/lapidary-render/) can convert much of OpenAPI 3.0 to Lapidary code.
At runtime, the library interprets user-provided function declarations and makes them behave as specified.
If a function accepts parameter of type `X` and returns `Y`, Lapidary will try to convert `X` to HTTP request and the response back to `Y`.
Check the [example](https://python-lapidary.github.io/lapidary/#usage)