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.0b2

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.0b2
File Size Uploaded Provenance Actions
syfthub_sdk-2.0.0b2.tar.gz 164.8 kB With provenance Details for syfthub_sdk-2.0.0b2.tar.gz

Built distribution (wheel)

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

Total release size: 235.8 kB

Release files / syfthub_sdk-2.0.0b2.tar.gz

Download URL syfthub_sdk-2.0.0b2.tar.gz
Size 164.8 kB
Tags Source
SHA-256 checksum
How to use checksums
934b4a4c31ed52bd913e32346cc61aad99c85fad3e542c7b792bb15e0dc9ad18
BLAKE2b-256 checksum
How to use checksums
b7a071c041ba432af0ec41d0e59ccc73e47ce903ca4bfbfe4fa9d1a65133148a
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 28, 2026.

Transparency log

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

Download URL syfthub_sdk-2.0.0b2-py3-none-any.whl
Size 71.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f4941e8f8c8ef86bd53b9bd426f63576e6f53933479d90170dc66e537a4e2634
BLAKE2b-256 checksum
How to use checksums
c704b20a27350a5b3c32d864e05d750f096fdfdff757e1095c15e90ab4da96c1
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 28, 2026.

Transparency log

Security for syfthub-sdk 2.0.0b2

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.0b2.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 28, 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