Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

SyftHub Python SDK

PyPI Python

syfthub is the Python client for SyftHub. Log in once, pick the sources you want to search, see what each one will cost and need before anything is sent, then run the search. Queries go straight from your process to each publisher's Space; the Hub is only consulted for the catalogue, the per-Space tokens and, for metered sources, the payment credential.

Documentation

The full guide is at docs/python/guides/sdk.md: sources, pre-flight, decisions, wallets, budgets, snapshots, options and errors.

Runnable examples, including a notebook and a chat app with SyftHub as retrieval, are in examples/.

Installation

pip install --pre syfthub-sdk            # pre-release until the first stable 2.x tag
pip install --pre 'syfthub-sdk[http2]'   # with HTTP/2, for Options(http2=True)

Requires Python 3.11 or newer.

Quick start

import syfthub

async with syfthub.AsyncHub(token="...") as hub:    # or set SYFTHUB_TOKEN
    plan = hub.search("adverse events in phase 3", ["erin/trials", "carol/papers"])
    pre = await plan.preflight()            # rows + actions; nothing sent, nothing spent
    for action in pre.actions:              # TopUp, OverBudget, AccessDenied, CircuitOpen
        plan = plan.skip(*action.paths)     # the one decision verb
    results = await plan.execute()          # one POST per Space, in parallel
    for path, doc in results.documents:     # best-scored chunks across sources
        print(path, doc.score, doc.content[:80])

The sync twin is the same API without await:

with syfthub.Hub(token="...") as hub:
    results = hub.search("adverse events in phase 3", ["erin/trials"]).execute()

Testing your app

syfthub.testing.FakeHub stands in for a Hub and its Spaces, with no extra dependency. See Testing your app in the guide.

Development

uv sync --all-extras
uv run ruff check src/ tests/
uv run mypy src/
uv run pytest tests/unit
uv run python scripts/gen_sync_stub.py   # after changing a public async method or what it returns

src/syfthub/_sync.pyi and src/syfthub/sync.py are generated from the async package. A unit test fails until they are regenerated.

License

Apache 2.0. See LICENSE.

Metadata

Release files for syfthub-sdk 2.0.0b1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for syfthub-sdk 2.0.0b1
File Size Uploaded Provenance Actions
syfthub_sdk-2.0.0b1.tar.gz 164.8 kB With provenance Details for syfthub_sdk-2.0.0b1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for syfthub-sdk 2.0.0b1
File Interpreter ABI Platform Actions
syfthub_sdk-2.0.0b1-py3-none-any.whl Python 3 none any Details for syfthub_sdk-2.0.0b1-py3-none-any.whl

Total release size: 235.8 kB

Release files / syfthub_sdk-2.0.0b1.tar.gz

Download URL syfthub_sdk-2.0.0b1.tar.gz
Size 164.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7b8beca3c03fbf39963eea33c999002c4587e95d732cb0d6a82177437d15b2e7
BLAKE2b-256 checksum
How to use checksums
4eb3df1948e219cb90a731143bea37564f0fdf527ff909be577a813bcfdd63aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / syfthub_sdk-2.0.0b1-py3-none-any.whl

Download URL syfthub_sdk-2.0.0b1-py3-none-any.whl
Size 71.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
358897bbbbc6f2f9e465a2541c1d64b02201966b9cccabcbb868b0a787268336
BLAKE2b-256 checksum
How to use checksums
ba32528200ba1715e7240d709dbf2b7d1d3fa428ae499a08328268311b5e5e52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for syfthub-sdk 2.0.0b1

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for syfthub_sdk-2.0.0b1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page