Starway UCX P2P communication lib.
Project description
Starway
Starway is an ultra-fast communication library that wraps OpenUCX to deliver lock-free, asynchronous, zero-copy messaging for Python applications.
Highlights
- Zero-copy transfers into preallocated NumPy buffers.
- Full-duplex messaging with independent async send/recv APIs.
- Choice of connection style: traditional TCP socket address or direct UCX worker-address handshakes (no TCP listener required).
- Flush primitives (
aflush,aflush_ep) to force completion ordering when you need delivery guarantees. - Built-in performance probes via
evaluate_perffor quick transport telemetry.
Installation
Starway depends on dynamic OpenUCX libraries:
- Install OpenUCX system-wide (for example via your distro's package manager or an HPC toolchain), or
- Install the
libucx-cu12wheel, which ships redistributable shared objects.
Starway does not hard-depend on libucx-cu12; it is treated as an optional
fallback.
You can use environment variable to control System/Wheel preference:
import os
# Defaults to "true". Set to "false" to prefer the wheel first.
os.environ["STARWAY_USE_SYSTEM_UCX"] = "false"
import starway # falls back to system UCX if the wheel is unavailable
Quick Start
Socket-address workflow
import asyncio
import numpy as np
from starway import Client, Server
SERVER_ADDR, SERVER_PORT = "127.0.0.1", 19198
async def main():
server = Server()
client = Client()
server.listen(SERVER_ADDR, SERVER_PORT)
await client.aconnect(SERVER_ADDR, SERVER_PORT)
# Establish endpoint object on the server side
client_ep = next(iter(server.list_clients()))
send_buf = np.arange(4, dtype=np.uint8)
recv_buf = np.zeros_like(send_buf)
recv_task = server.arecv(recv_buf, tag=1, tag_mask=0xFFFF)
await client.asend(send_buf, tag=1)
await recv_task
await asyncio.gather(client.aflush(), server.aflush_ep(client_ep))
await asyncio.gather(client.aclose(), server.aclose())
asyncio.run(main())
Worker-address workflow
import asyncio
import numpy as np
from starway import Client, Server
async def main():
server = Server()
worker_address = server.listen_address() # bytes blob, no TCP listener
client = Client()
await client.aconnect_address(worker_address)
# Accept callback still fires; poll list_clients() to obtain the peer ep
for _ in range(100):
clients = server.list_clients()
if clients:
client_ep = next(iter(clients))
break
await asyncio.sleep(0.01)
recv_buf = np.zeros(4, dtype=np.uint8)
recv_task = server.arecv(recv_buf, tag=2, tag_mask=0xFFFF)
await client.asend(np.arange(4, dtype=np.uint8), tag=2)
await recv_task
await asyncio.gather(client.aclose(), server.aclose())
asyncio.run(main())
API Cheatsheet
Server
listen(addr, port)– create a TCP-backed listener.listen_address()– start worker-only mode and return the local UCX worker address for out-of-band distribution.set_accept_cb(callback)– invoked for each new endpoint (both listener and worker-address flows).list_clients()– inspect active UCX endpoints.asend(client_ep, buffer, tag)/arecv(buffer, tag, tag_mask)– async one-sided messaging.aflush()– wait for all server-side operations to complete.aflush_ep(client_ep)– flush operations targeting a specific endpoint.evaluate_perf(client_ep, msg_size)– request UCX transport estimates.get_worker_address()– read back the cached worker address bytes.aclose()– gracefully shut down and release resources.
Client
aconnect(addr, port)– connect to a listener.aconnect_address(worker_address)– connect using a UCX worker address only.asend(buffer, tag)/arecv(buffer, tag, tag_mask)– async messaging APIs.aflush()– wait for in-flight client operations to finish.evaluate_perf(msg_size)– ask UCX for local transport estimates.get_worker_address()– shareable bytes for reciprocal connections.aclose()– close the connection and stop the worker.
ServerEndpoint
Inspect transport metadata for debugging or topology decisions:
.name– UCX endpoint name..local_addr,.local_port,.remote_addr,.remote_port– socket details when available (address-only mode may leave these empty)..view_transports()– list(device, transport)tuples negotiated by UCX.
Flushing and Ordering
UCX operations are inherently asynchronous. Starway exposes lightweight futures on top of UCX requests and lets you opt into ordering guarantees:
Client.aflush()andServer.aflush()drain all pending operations on their respective workers.Server.aflush_ep(ep)waits for sends targeting a single endpoint.- All async flushes integrate with Python's event loop, making them suitable for
structured concurrency patterns (
await asyncio.gather(...)).
Testing
Pytest drives the integration suite. Typical commands:
uv sync --group dev --group test
uv run pytest tests/test_basic.py -vv
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file starway-0.6.0.tar.gz.
File metadata
- Download URL: starway-0.6.0.tar.gz
- Upload date:
- Size: 64.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04a5440596425aea9020e86e5971ec81a16938da44ba96e9916bbd0100bb765d
|
|
| MD5 |
bc7e3123a7b2cf2d6113620373d9d13e
|
|
| BLAKE2b-256 |
411915d4482c0aa66d948e6872ae81895c890f595329b360430e438da7c05d98
|
Provenance
The following attestation bundles were made for starway-0.6.0.tar.gz:
Publisher:
wheels.yml on Clouder0/starway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starway-0.6.0.tar.gz -
Subject digest:
04a5440596425aea9020e86e5971ec81a16938da44ba96e9916bbd0100bb765d - Sigstore transparency entry: 626368159
- Sigstore integration time:
-
Permalink:
Clouder0/starway@edd940f5c8d97283c4c732fd8d31e9634185edee -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Clouder0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@edd940f5c8d97283c4c732fd8d31e9634185edee -
Trigger Event:
release
-
Statement type:
File details
Details for the file starway-0.6.0-cp313-cp313-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: starway-0.6.0-cp313-cp313-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 210.3 kB
- Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0692f9311c26ec79c5bcab8061797b9f3e08b2ba72a9ee390c84ee9b908305d5
|
|
| MD5 |
74fe3e995d5ee0e7e89ec26397e29749
|
|
| BLAKE2b-256 |
57312ab1626ba6be44750ab7e12a0d34587dc2a677e7a0c27e6278f76ddfdb99
|
Provenance
The following attestation bundles were made for starway-0.6.0-cp313-cp313-manylinux_2_34_x86_64.whl:
Publisher:
wheels.yml on Clouder0/starway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starway-0.6.0-cp313-cp313-manylinux_2_34_x86_64.whl -
Subject digest:
0692f9311c26ec79c5bcab8061797b9f3e08b2ba72a9ee390c84ee9b908305d5 - Sigstore transparency entry: 626368162
- Sigstore integration time:
-
Permalink:
Clouder0/starway@edd940f5c8d97283c4c732fd8d31e9634185edee -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Clouder0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@edd940f5c8d97283c4c732fd8d31e9634185edee -
Trigger Event:
release
-
Statement type:
File details
Details for the file starway-0.6.0-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: starway-0.6.0-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 210.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b6ae700d48860b0122b58ef28ab7a67ec6d34f2c99c6ffa010965d05b2c9d13
|
|
| MD5 |
219d3760ef98174b9ebe73fa9c7d1988
|
|
| BLAKE2b-256 |
3d2ca357a063eef799f20780e78cb0704a78212a6d99819b411f545a5398ed69
|
Provenance
The following attestation bundles were made for starway-0.6.0-cp312-cp312-manylinux_2_34_x86_64.whl:
Publisher:
wheels.yml on Clouder0/starway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starway-0.6.0-cp312-cp312-manylinux_2_34_x86_64.whl -
Subject digest:
4b6ae700d48860b0122b58ef28ab7a67ec6d34f2c99c6ffa010965d05b2c9d13 - Sigstore transparency entry: 626368163
- Sigstore integration time:
-
Permalink:
Clouder0/starway@edd940f5c8d97283c4c732fd8d31e9634185edee -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Clouder0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@edd940f5c8d97283c4c732fd8d31e9634185edee -
Trigger Event:
release
-
Statement type:
File details
Details for the file starway-0.6.0-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: starway-0.6.0-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 210.6 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c74734bbe82c5587758e7c6fbb893513dad9f80d3fbd1b6f39de508669655947
|
|
| MD5 |
005060bcf17a6b51ce79b7768e4e1aa2
|
|
| BLAKE2b-256 |
09cf508a4abd2678b217e9b8a56faedb8c3f3a8c86782f4dbe20dfba192b9976
|
Provenance
The following attestation bundles were made for starway-0.6.0-cp311-cp311-manylinux_2_34_x86_64.whl:
Publisher:
wheels.yml on Clouder0/starway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starway-0.6.0-cp311-cp311-manylinux_2_34_x86_64.whl -
Subject digest:
c74734bbe82c5587758e7c6fbb893513dad9f80d3fbd1b6f39de508669655947 - Sigstore transparency entry: 626368161
- Sigstore integration time:
-
Permalink:
Clouder0/starway@edd940f5c8d97283c4c732fd8d31e9634185edee -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Clouder0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@edd940f5c8d97283c4c732fd8d31e9634185edee -
Trigger Event:
release
-
Statement type:
File details
Details for the file starway-0.6.0-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: starway-0.6.0-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 210.9 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bd3a06d615b9541d4d10f46a3c42df51850920945a2ffe367a2f24b4db4e19c
|
|
| MD5 |
e92472472dafa1f37eedbf38d99b5819
|
|
| BLAKE2b-256 |
428d3956a5b266ad4c0eb0921ae2b9a5b551281f89b93f70768ac8a7679bfd7f
|
Provenance
The following attestation bundles were made for starway-0.6.0-cp310-cp310-manylinux_2_34_x86_64.whl:
Publisher:
wheels.yml on Clouder0/starway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
starway-0.6.0-cp310-cp310-manylinux_2_34_x86_64.whl -
Subject digest:
2bd3a06d615b9541d4d10f46a3c42df51850920945a2ffe367a2f24b4db4e19c - Sigstore transparency entry: 626368164
- Sigstore integration time:
-
Permalink:
Clouder0/starway@edd940f5c8d97283c4c732fd8d31e9634185edee -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Clouder0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@edd940f5c8d97283c4c732fd8d31e9634185edee -
Trigger Event:
release
-
Statement type: