d2b-sdk — D2B Python SDK
Spreadsheets for AI Agents: typed, versioned, governed tables behind an agent-native API.
pip install d2b-sdk
The distribution is d2b-sdk; the import package and the command are both
d2b (d2b on PyPI is an unrelated project). With uvx, that means
uvx --from d2b-sdk d2b ....
from d2b import D2BClient, ConflictError
client = D2BClient(api_key="d2b_pat_...", base_url="https://d2b.dev")
wb = client.workbooks.create(title="monthly")["id"]
# Large files are safe: the SDK drives the async ingest and waits on the job.
client.sources.upload(wb, "sales.xlsx", wait=True)
for t in client.tables.list(wb):
print(t["name"], t["row_count"])
# Row edits are optimistically locked — a 409 is ConflictError, and the
# contract is to re-read and re-apply rather than retry.
page = client.tables.rows(wb, "sales")
try:
client.tables.upsert_rows(
wb, "sales",
rows=[{"product": "apple", "qty": 3}],
expected_version=page["edit_version"],
)
except ConflictError:
page = client.tables.rows(wb, "sales")
The client is a thin skin over the REST API — every method maps to one endpoint:
- an
Idempotency-Keyon every mutating call (retry-safe); - exponential-backoff retry on 429 / 5xx. 409 is never retried;
- problem+json errors raised with their
suggested_fixattached (written for LLMs to read and react to); - helpers for the parts that bite:
jobs.wait(),tables.iter_rows(),webhooks.verify_delivery()(signature + send-time check).
Docs: docs.d2b.dev/en/sdks · CLI · API reference · 日本語
Package: PyPI · Source and issues:
github.com/600/d2b-sdk (python/; a
read-only mirror of the main repository — issues welcome, pull requests can't
be merged there).
CLI
d2b login # browser login; no raw API keys
d2b workbooks create --title monthly
d2b upload sales.xlsx --workbook WB --wait
d2b query 'SELECT 1' --workbook WB
d2b pull --workbook WB # transforms/ sheets/ charts/ + d2b.json
d2b pull --data customers # track base tables as data/*.csv too
d2b push --commit "$(git rev-parse --short HEAD)" # re-run what changed, then name the version after the commit
d2b github-workflow > .github/workflows/d2b.yml # CI: push on merge to main, scheduled pull → PR
Output is JSON on stdout; errors carry their suggested_fix on stderr; exit
codes are 0 / 1 (API errors, refused syncs) / 2 (usage). Nothing prompts
interactively.
d2b login targets https://d2b.dev unless --base-url or $D2B_BASE_URL
says otherwise. For non-interactive use set D2B_API_KEY and D2B_BASE_URL
— never pass secrets as command-line arguments (--api-key is not
accepted, and secret-shaped strings are redacted from error messages).
License
MIT (LICENSE). "D2B", its name and logo, are trademarks and are not covered by this license.
Metadata
Release files for d2b-sdk 0.2.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 |
|---|---|---|---|---|
| d2b_sdk-0.2.0.tar.gz | 71.8 kB | Without provenance | Details for d2b_sdk-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| d2b_sdk-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for d2b_sdk-0.2.0-py3-none-any.whl |
Total release size: 125.9 kB
Release files / d2b_sdk-0.2.0.tar.gz
| Download URL | d2b_sdk-0.2.0.tar.gz |
|---|---|
| Size | 71.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b4c0ec64d8ea0dcd44c362dcc3d7326a558106d0159d8f81423d4fc335d8287
|
|
BLAKE2b-256 checksum How to use checksums |
f9ea0ab5093cf760c3975124789fe34d885d3b190f12df589c0e465686c3c39d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / d2b_sdk-0.2.0-py3-none-any.whl
| Download URL | d2b_sdk-0.2.0-py3-none-any.whl |
|---|---|
| Size | 54.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a0ce40fc2d1fc52985f1b3bac77664b704214c2ca4174b943bc79c8d71a1474
|
|
BLAKE2b-256 checksum How to use checksums |
6dc5e8e3b41f470a6daba836ac083ac35ca413fbdab6ec85f6ba7cb9994e3d28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for d2b-sdk 0.2.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.