Skip to main content

spoke-connect (Python)

PyPI package spoke-connect: SPOKE Connect session-core bindings (generated uniffi Python + native spoke_connect / libspoke_connect).

Packaging contract: connect-binding-channels.md §3.3.

Install

At spoke lockstep tag vX.Y.Z:

pip install spoke-connect==X.Y.Z

Platform wheels (py3-none-<platform>) ship for manylinux_2_35_x86_64, macosx_11_0_arm64, and win_amd64. Each wheel bundles that platform's shared library beside the spoke_connect module (uniffi ctypes loader contract). Version locksteps with the spoke monorepo SemVer / git tag vX.Y.Z.

Release publishes via Trusted Publishing on the top-level release.yml workflow (publish-pypi job, OIDC). The PyPI Pending publisher for spoke-connect binds repository 42ch-dev/spoke to that workflow filename; the first successful stable-tag publish activates the project on PyPI.

Usage

import spoke_connect

peer_id = spoke_connect.derive_peer_id_from_ed25519_pubkey(pubkey)
protocol = spoke_connect.protocol_version()  # 1

Transport / WebSocket stays in the host product.

Build features

Artifact Cargo features Notes
Committed spoke_connect/ ffi,remote-adapter Production surface: RemoteAdapterFFI, MultiPeerRouterFFI, Transport, loopback_transport_pair — no start_loopback_smoke_host
Local loopback smoke cdylib + bindings ffi,remote-adapter,ffi-smoke-host Adds loopback smoke host FFI for the RemoteAdapter section

ffi-smoke-host is non-default and is not implied by remote-adapter or ffi. Full loopback smoke procedure: Smoke/README.md.

RemoteAdapter FFI surface

With remote-adapter enabled, the binding ships the additive remote-adapter surface: RemoteAdapterFFI (single peer), MultiPeerRouterFFI (multi-peer routing), the callback Transport interface, and the in-memory loopback helpers.

Transport contract

The callback Transport is a message-oriented interface: one envelope per call, blocking receive, idempotent close.

Method Behavior
send(envelope) Accepts exactly one connect envelope's bytes per call
recv() Blocks until the next inbound envelope arrives or the connection closes; returns exactly one envelope per call
close() Releases transport resources; idempotent — closing either end of a connection fails the peer's pending recv like a real connection drop

The surface bounds messages at one envelope per call; byte-stream carriers apply length-prefix (or equivalent) delimiting before handing envelopes to the adapter.

MultiPeerRouterFFI

new_multi_peer_router_ffi() returns the router as a synchronous object over the same runtime: a peer registry (register_peer(adapter) accepts an established RemoteAdapterFFI and returns its peer_id; unregister_peer(peer_id); list_peers()), the BaselinePorts six families routed per call to exactly one capable peer, and the two HostManifestPort aggregation views — the composed get_host_capability_manifest() and the per-peer list_peer_host_capability_manifests(). Selection matches each registered peer's cached HostCapabilityManifest: required capability, exact namespace, soft role preference, and a deterministic lowest-peer_id tie-break.

Layout

Path Contents
pyproject.toml Packable project (name = spoke-connect; lockstep SemVer)
setup.py Platform wheel tag hook (py3-none-<platform>; no sdist)
spoke_connect/ Import package — committed generated __init__.py + host native for smoke
native/ Staging contract for non-host RIDs (see native/README.md)
Smoke/ Golden-parity + RemoteAdapter loopback smoke — see Smoke/README.md

Maintainer: regenerate → stage native → wheel → smoke

Commands from the repository root (local nightly convention for cargo: cargo +nightly …).

Production regenerate uses ffi,remote-adapter only (no ffi-smoke-host). Full loopback smoke recipe: Smoke/README.md.

# 1. Build the production ffi cdylib (must run before generate — default build replaces the stub)
cargo +nightly build -p spoke-connect --features ffi,remote-adapter --release

# 2. Generate bindings (first-party uniffi 0.32)
cargo +nightly run -p spoke-connect --features ffi,bindgen-cli,remote-adapter --bin uniffi-bindgen -- \
  generate --library target/release/libspoke_connect.dylib \
  --language python --out-dir crates/spoke-connect/bindings/python/spoke_connect
mv crates/spoke-connect/bindings/python/spoke_connect/spoke_connect.py \
   crates/spoke-connect/bindings/python/spoke_connect/__init__.py

# 3. Stage host native beside the module (darwin arm64 example)
cp target/release/libspoke_connect.dylib \
  crates/spoke-connect/bindings/python/spoke_connect/
install_name_tool -id @rpath/libspoke_connect.dylib \
  crates/spoke-connect/bindings/python/spoke_connect/libspoke_connect.dylib

# 4. Golden-parity smoke (no wheel required)
PYTHONPATH=crates/spoke-connect/bindings/python \
  python3 -m unittest discover -s crates/spoke-connect/bindings/python/Smoke -v

# 5. Build platform wheel (host RID or CI artifact — recipe: tooling/connect/build-python-wheel.sh)
./tooling/connect/build-python-wheel.sh

# Release: all three wheels from build-connect-ffi artifacts
./tooling/connect/build-python-wheels-from-ffi.sh ffi-assembled

v1 publishes platform wheels only (no sdist): a source install cannot produce the native library without a Rust toolchain.

Committed natives (in-tree smoke)

Wheel platform (PEP 425) Native Status
macosx_11_0_arm64 spoke_connect/libspoke_connect.dylib Committed — maintainer-built (release)
manylinux_2_35_x86_64 libspoke_connect.so CI — stage from release.yml build-connect-ffi (linux-x64, ubuntu-22.04) before wheel build
win_amd64 spoke_connect.dll CI — stage from build-connect-ffi (win-x64) before wheel build

Reference

Metadata

Release files for spoke-connect 0.9.2

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

Built distributions (wheels)

Table of built distributions (wheels) for spoke-connect 0.9.2
File Interpreter ABI Platform Actions
spoke_connect-0.9.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for spoke_connect-0.9.2-py3-none-win_amd64.whl
spoke_connect-0.9.2-py3-none-manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.35+ x86-64 Details for spoke_connect-0.9.2-py3-none-manylinux_2_35_x86_64.whl
spoke_connect-0.9.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for spoke_connect-0.9.2-py3-none-macosx_11_0_arm64.whl

Total release size: 8.4 MB

Release files / spoke_connect-0.9.2-py3-none-win_amd64.whl

Download URL spoke_connect-0.9.2-py3-none-win_amd64.whl
Size 2.8 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
87c59a30defe61be59eba8a308dcff12d8fc70233139ea4f51d4679e65d6f1dd
BLAKE2b-256 checksum
How to use checksums
deae9a9b1783bac9b84e0817358571f08de28d5fe8be7fda9d12341fd3263ff8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / spoke_connect-0.9.2-py3-none-manylinux_2_35_x86_64.whl

Download URL spoke_connect-0.9.2-py3-none-manylinux_2_35_x86_64.whl
Size 1.5 MB
Tags Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d9eee5cebe747d1aeead0ee353d5121450d0ee65ceeefe8af0c4c4c348bcc54e
BLAKE2b-256 checksum
How to use checksums
2710b818beae344db4e7ff343c3fefed8cec67f003376bc793a73a4e2eae7e5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Release files / spoke_connect-0.9.2-py3-none-macosx_11_0_arm64.whl

Download URL spoke_connect-0.9.2-py3-none-macosx_11_0_arm64.whl
Size 4.1 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
92f0762788e6763a48a746a2573ef4ea24dd98ca0acfff51ed2be221f3840490
BLAKE2b-256 checksum
How to use checksums
796caa1430890ef683c9938a32244523a8e4ef7d3e7a7a827fe3fa15a82e8d8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 7, 2026.

Transparency log

Security for spoke-connect 0.9.2

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 3 files in this release have been uploaded with provenance metadata.

Select from 3 files

Attestation for spoke_connect-0.9.2-py3-none-win_amd64.whl

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 Aug 7, 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