Facet Terminal Python SDK — typed client generated from openapi/openapi.yaml plus an ergonomic discovery + auth wrapper.
Project description
facet-sdk (Python)
Python SDK for the Facet Terminal — the per-merchant HTTP contract that every Facet deployment exposes.
The typed request/response surface is generated from openapi/openapi.yaml
via openapi-python-client.
A thin ergonomic wrapper at facet_sdk provides defaults (User-Agent,
timeout) and an authenticated-client factory.
Phase 8 of
openapi-as-contract. The wire surface is spec-driven — never editsrc/facet_terminal_client/by hand. Runbash scripts/regenerate.shafterscripts/build-openapi.shto pull in the latest spec.
Install
pip install facet-sdk
Quickstart
from facet_sdk import create_terminal_client
from facet_terminal_client.api.protocol_core import get_health, get_capabilities
client = create_terminal_client("https://terminal.facet.llc")
health = get_health.sync(client=client)
# `health` is a HealthResponse, a FacetErrorEnvelope, or None
caps = get_capabilities.sync(client=client)
Authenticated calls (KYA token)
Endpoints in the four-verb commerce primitive surface (search, quote, reserve, settle) and most tool surfaces require a KYA bearer token:
from facet_sdk import create_terminal_client
from facet_terminal_client.api.protocol_core import quote
from facet_terminal_client.models import QuoteRequest
client = create_terminal_client(
"https://terminal.facet.llc",
kya_token="kya-bearer-from-skyfire-or-similar",
)
resp = quote.sync(client=client, body=QuoteRequest(sku="abc", quantity=1))
Architecture
| Layer | Module | What it is |
|---|---|---|
| Ergonomic helpers | facet_sdk |
Hand-written wrappers (create_terminal_client). Stable API. |
| Typed wire surface | facet_terminal_client.api.* |
Auto-generated per-endpoint functions. Do not edit. |
| Typed schemas | facet_terminal_client.models.* |
Auto-generated attrs classes for every components.schemas.*. Do not edit. |
| Generated client | facet_terminal_client.Client / AuthenticatedClient |
Auto-generated httpx-backed dispatch class. |
Regenerating from the spec
# Prerequisite: openapi-python-client on PATH
pipx install openapi-python-client==0.28.4
# Regenerate just sdk-python:
bash packages/sdk-python/scripts/regenerate.sh
# Or regenerate all three language SDKs from the spec:
bash scripts/regenerate-sdks.sh
The regen scripts are idempotent — running twice produces no diff
unless openapi/openapi.yaml changed.
Tests
# Unit tests (offline):
pip install -e .[dev]
pytest
# Smoke tests against a live Facet Terminal (gated by marker):
pytest -m smoke
# Override the smoke target:
FACET_SMOKE_BASE_URL=https://my-merchant.example.com pytest -m smoke
License
Apache-2.0.
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 facet_sdk-0.1.0.tar.gz.
File metadata
- Download URL: facet_sdk-0.1.0.tar.gz
- Upload date:
- Size: 94.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2feeafdad44851b3be36cf434ee5e99b829121cb9d930e7aa1a8071e875e8dd4
|
|
| MD5 |
6892488cc03dc13e9e9e294035b055e2
|
|
| BLAKE2b-256 |
43d378ff26bc5e70e70837fa786cb885467afba4f1dff830648bb31338596539
|
Provenance
The following attestation bundles were made for facet_sdk-0.1.0.tar.gz:
Publisher:
publish-sdks.yml on lynz-tonomi/facet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
facet_sdk-0.1.0.tar.gz -
Subject digest:
2feeafdad44851b3be36cf434ee5e99b829121cb9d930e7aa1a8071e875e8dd4 - Sigstore transparency entry: 1632465774
- Sigstore integration time:
-
Permalink:
lynz-tonomi/facet@36264db71c7ebf4ad4a50c1dc36e3377e5c1fa69 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lynz-tonomi
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@36264db71c7ebf4ad4a50c1dc36e3377e5c1fa69 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file facet_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: facet_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 347.4 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 |
51dd2849462471fbdd227e490d46552b15663c87320955c34ef8d0be088f3f52
|
|
| MD5 |
d77904be3810164af00750dd62d30308
|
|
| BLAKE2b-256 |
1715f0fc9c1abcec489641336766962c34e59c9756946d81e0a4bf53ddc4492f
|
Provenance
The following attestation bundles were made for facet_sdk-0.1.0-py3-none-any.whl:
Publisher:
publish-sdks.yml on lynz-tonomi/facet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
facet_sdk-0.1.0-py3-none-any.whl -
Subject digest:
51dd2849462471fbdd227e490d46552b15663c87320955c34ef8d0be088f3f52 - Sigstore transparency entry: 1632465789
- Sigstore integration time:
-
Permalink:
lynz-tonomi/facet@36264db71c7ebf4ad4a50c1dc36e3377e5c1fa69 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/lynz-tonomi
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sdks.yml@36264db71c7ebf4ad4a50c1dc36e3377e5c1fa69 -
Trigger Event:
workflow_dispatch
-
Statement type: