Skip to main content

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_perf for quick transport telemetry.

Installation

Starway depends on dynamic OpenUCX libraries:

  1. Install OpenUCX system-wide (for example via your distro's package manager or an HPC toolchain), or
  2. Install the libucx-cu12 wheel, 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() and Server.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

Metadata

Release files for starway 0.6.0

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

Source distribution (sdist)

Source distribution for starway 0.6.0
File Size Uploaded
starway-0.6.0.tar.gz 64.2 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for starway 0.6.0
File
starway-0.6.0-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
starway-0.6.0-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
starway-0.6.0-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details
starway-0.6.0-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details

Total release size: 906.5 kB

Release files / starway-0.6.0.tar.gz

Download URL starway-0.6.0.tar.gz
Size 64.2 kB
Tags Source
SHA-256 checksum
How to use checksums
04a5440596425aea9020e86e5971ec81a16938da44ba96e9916bbd0100bb765d
BLAKE2b-256 checksum
How to use checksums
411915d4482c0aa66d948e6872ae81895c890f595329b360430e438da7c05d98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 21, 2025.

Transparency log

Release files / starway-0.6.0-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL starway-0.6.0-cp313-cp313-manylinux_2_34_x86_64.whl
Size 210.3 kB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
0692f9311c26ec79c5bcab8061797b9f3e08b2ba72a9ee390c84ee9b908305d5
BLAKE2b-256 checksum
How to use checksums
57312ab1626ba6be44750ab7e12a0d34587dc2a677e7a0c27e6278f76ddfdb99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 21, 2025.

Transparency log

Release files / starway-0.6.0-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL starway-0.6.0-cp312-cp312-manylinux_2_34_x86_64.whl
Size 210.4 kB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
4b6ae700d48860b0122b58ef28ab7a67ec6d34f2c99c6ffa010965d05b2c9d13
BLAKE2b-256 checksum
How to use checksums
3d2ca357a063eef799f20780e78cb0704a78212a6d99819b411f545a5398ed69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 21, 2025.

Transparency log

Release files / starway-0.6.0-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL starway-0.6.0-cp311-cp311-manylinux_2_34_x86_64.whl
Size 210.6 kB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
c74734bbe82c5587758e7c6fbb893513dad9f80d3fbd1b6f39de508669655947
BLAKE2b-256 checksum
How to use checksums
09cf508a4abd2678b217e9b8a56faedb8c3f3a8c86782f4dbe20dfba192b9976
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 21, 2025.

Transparency log

Release files / starway-0.6.0-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL starway-0.6.0-cp310-cp310-manylinux_2_34_x86_64.whl
Size 210.9 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
2bd3a06d615b9541d4d10f46a3c42df51850920945a2ffe367a2f24b4db4e19c
BLAKE2b-256 checksum
How to use checksums
428d3956a5b266ad4c0eb0921ae2b9a5b551281f89b93f70768ac8a7679bfd7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.0 This release

5 release files

0.5.0

5 release files

0.4.0

5 release files

0.3.0

5 release files

0.2.6

5 release files

0.2.5

5 release files

0.2.3

5 release files

0.2.2

5 release files

0.2.1

5 release files

0.1.4

5 release files

0.1.0

5 release files

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