patchwell
Transcription, data cleaning and cited web research from Python. Pay per result: a failed or refused call costs nothing. Standard library only, so it runs in Lambda, Airflow, cron jobs and notebooks.
pip install patchwell
export PATCHWELL_KEY=pw_live_... # a free key with $1 of credit: https://patchwell.io/#try
from patchwell import Patchwell
pw = Patchwell()
# Clean a file, a list of dicts, or several sources merged into one table
clean = pw.clean_data(url="https://example.com/leads.csv")
clean = pw.clean_data(rows=[{"Email": "ANN@X.COM", "Name": "ann lee"}])
clean = pw.clean_data(inputs=[{"url": "https://example.com/crm.csv"}, {"rows": scraped, "name": "web"}])
# Only the rows you haven't sent before, for a daily job
new = pw.clean_data(url=export_url, only_new={"state": "daily-leads", "key": ["Email"]})
# Check rows against your rules and map them onto your import template
ready = pw.clean_data(rows=rows, rules=[{"column": "Age", "range": [0, 120]}],
target={"columns": [{"name": "email", "required": True}, {"name": "name"}]})
# Transcribe: waits for long recordings (polls with the server's Retry-After)
t = pw.transcribe("https://example.com/interview.mp3")
print(t["text"])
open("interview.srt", "w").write(t["srt"])
# Research with a cited source for every claim
# ($0.02 per answered question; declined and unanswered questions are free)
a = pw.research("Which EU countries require B2B e-invoicing in 2026?")
print(a["answer"], a["gaps"])
# Hard multi-step questions: depth="deep" searches about twice as wide ($0.06 per answered question).
# private=True keeps the question inside Modal, the cloud Patchwell runs on: same price.
d = pw.research("How old was the author of Dracula when it was published?", depth="deep")
# A worked-out answer's claim has "derived": True, "derived_from" (the facts it rests on) and "calc"
# Results as files
open("clean.xlsx", "wb").write(pw.export(clean, "xlsx"))
Retries never charge twice
Every POST carries an Idempotency-Key. On a retryable error (rate_limited, unavailable, a request still running)
the SDK waits for Retry-After and sends the same key again, so you get the first response and pay once.
Pass your own idempotency_key= (an order or row id) and a later rerun of the same item, by cron or by hand,
returns the first result instead of paying again.
Errors
from patchwell import PatchwellError
try:
pw.clean_data(url=url)
except PatchwellError as e:
if e.code == "insufficient_credit":
... # top up at https://patchwell.io/#buy
print(e.code, e.retryable, e.request_id)
Codes:
invalid_input, unauthorized, insufficient_credit, forbidden, not_found, method_not_allowed, too_large, idempotency_in_progress, idempotency_mismatch, rate_limited, source_unavailable, unavailable, tool_paused, internal, cancelled, expired, network, timeout, job_failed.
source_unavailable: the site hosting your file failed for a moment. A job that fails while you wait
raises with the server's own code and retryable.
Long jobs without waiting
job = pw.transcribe(url, wait=False) # {"status": "running", "job_id": "fc-..."}
result = pw.wait(job["job_id"], timeout=3600)
Or send callback_url= and verify the webhook:
from patchwell import verify_webhook
ok = verify_webhook(secret, request.body, request.headers["Patchwell-Signature"])
The full API reference: https://patchwell.io/quickstart
Metadata
Release files for patchwell 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| patchwell-0.1.0.tar.gz | 11.1 kB | Without provenance | Details for patchwell-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| patchwell-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for patchwell-0.1.0-py3-none-any.whl |
Total release size: 19.8 kB
Release files / patchwell-0.1.0.tar.gz
| Download URL | patchwell-0.1.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27d7cc107c40b3adb0995432db2affc6d74be3282d6c4c5e84868f9fe1ff3c39
|
|
BLAKE2b-256 checksum How to use checksums |
0873c7f2d665b2576ac6d14e9472c93a2a34383122b6366ec49abf48f262d652
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Release files / patchwell-0.1.0-py3-none-any.whl
| Download URL | patchwell-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9d22231286684d2fc2beb1479c9922b87cd6db9c92b7bce4fde6ab26bdb52c9
|
|
BLAKE2b-256 checksum How to use checksums |
447759605d51ffd26b6fe7bc7822e91f083325f5a19d12ae351aff1e11a13664
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.3
|
Security for patchwell 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.