Public Python SDK for calling remote functions, with sync and async clients.
Project description
paperclip-sdk
Python SDK for calling server-hosted Paperclip tools from scripts, workers, web apps, and async services.
Use it when you want to keep business logic, pricing rules, private workflows, or customer-specific functionality on the server while calling it from Python through a small client.
Install
poetry add paperclip-sdk
or
pip install paperclip-sdk
Configure authentication
export LEASEKEY_API_KEY="your-api-key"
Quickstart
Sync
from paperclip_sdk import Paperclip
with Paperclip() as paperclip: result = paperclip.tools.core.hello_world(name="Ada") print(result)
Async
import asyncio from paperclip_sdk import AsyncPaperclip
async def main() -> None: async with AsyncPaperclip() as paperclip: result = await paperclip.tools.core.hello_world(name="Ada") print(result)
asyncio.run(main())
Real-world examples
The tool names below are illustrative. Replace them with the tools your Paperclip server exposes.
Keep pricing logic on the server
from decimal import Decimal from paperclip_sdk import Paperclip
def quote_total(customer_id: str, sku: str, quantity: int) -> Decimal: with Paperclip() as paperclip: result = paperclip.tools.pricing.compute_quote( customer_id=customer_id, sku=sku, quantity=quantity, )
return Decimal(result["total"])
Use it inside an async API
from fastapi import FastAPI from paperclip_sdk import AsyncPaperclip
app = FastAPI()
@app.post("/tickets/{ticket_id}/summarize") async def summarize_ticket(ticket_id: str) -> dict: async with AsyncPaperclip() as paperclip: return await paperclip.tools.support.summarize_ticket( ticket_id=ticket_id, )
Build a remote plugin system
from paperclip_sdk import Paperclip
with Paperclip() as paperclip: result = paperclip.tools.plugins.transform_payload( payload={ "source": "stripe", "event": "invoice.paid", } ) print(result)
Reuse a tool handle
from paperclip_sdk import Paperclip
with Paperclip() as paperclip: enrich_contact = paperclip.tools.crm.enrich_contact
print(enrich_contact(email="ada@example.com"))
print(enrich_contact(email="grace@example.com"))
Reuse an async tool handle
import asyncio from paperclip_sdk import AsyncPaperclip
async def main() -> None: async with AsyncPaperclip() as paperclip: summarize = paperclip.tools.support.summarize_ticket
print(await summarize(ticket_id="T-100"))
print(await summarize(ticket_id="T-101"))
asyncio.run(main())
Notes
- Tools are available under
paperclip.tools.<namespace>.<name>(...) - The default base URL is
https://leasekey.org, so passingbase_urlis optional - The SDK automatically sends
User-Agent: paperclip-sdk/<version> - The SDK also sends
X-Leasekey-SDK-Version: <version> - Built-in retry behavior covers retryable transport failures and these HTTP statuses: 408, 425, 429, 502, 503, 504
Project details
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 paperclip_sdk-0.4.0.tar.gz.
File metadata
- Download URL: paperclip_sdk-0.4.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c290b7c9d266dbcf1dbe4751d914b1cccf72939f625fa464bd7d02a6e659be9
|
|
| MD5 |
5189f9840aa0787a88cae12fd96c4b55
|
|
| BLAKE2b-256 |
c85a3f6461b0d390ea7208b153e41a4ed5a2c87bf6a6246d42c10114ea6860d2
|
Provenance
The following attestation bundles were made for paperclip_sdk-0.4.0.tar.gz:
Publisher:
publish.yml on janfilips/paperclip-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paperclip_sdk-0.4.0.tar.gz -
Subject digest:
0c290b7c9d266dbcf1dbe4751d914b1cccf72939f625fa464bd7d02a6e659be9 - Sigstore transparency entry: 1109254459
- Sigstore integration time:
-
Permalink:
janfilips/paperclip-server@496117fee0fccd2442578048b954be55015ce57b -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/janfilips
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@496117fee0fccd2442578048b954be55015ce57b -
Trigger Event:
release
-
Statement type:
File details
Details for the file paperclip_sdk-0.4.0-py3-none-any.whl.
File metadata
- Download URL: paperclip_sdk-0.4.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
213e694b2e444d64b332ed9350e41385abf61c85845fa958f11b7e1f05dce8d2
|
|
| MD5 |
464cd27261e393889fc582c639830235
|
|
| BLAKE2b-256 |
c82c8eebad04b1570e0df665092127612be86000acbb95d214bbef05fc52c0f2
|
Provenance
The following attestation bundles were made for paperclip_sdk-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on janfilips/paperclip-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
paperclip_sdk-0.4.0-py3-none-any.whl -
Subject digest:
213e694b2e444d64b332ed9350e41385abf61c85845fa958f11b7e1f05dce8d2 - Sigstore transparency entry: 1109254464
- Sigstore integration time:
-
Permalink:
janfilips/paperclip-server@496117fee0fccd2442578048b954be55015ce57b -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/janfilips
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@496117fee0fccd2442578048b954be55015ce57b -
Trigger Event:
release
-
Statement type: