Skip to main content

shuflr-client

Python client for shuflr — streaming shuffled JSONL records over the network for LLM training and analytics.

Rust core with pyo3 bindings, shipped as a single maturin-built abi3 wheel (Python 3.9+). No tokio, no async — blocking sockets compose cleanly with PyTorch's multiprocessing DataLoader workers.

pip install shuflr-client

Usage

import shuflr_client

ds = shuflr_client.Dataset(
    "http://127.0.0.1:9000/v1/streams/corpus",
    seed=42,
    shuffle="chunk-shuffled",   # or "index-perm" for provably uniform
    epochs=0,                   # 0 = infinite
    sample=None,                # or N to cap
    rank=0, world_size=4,       # distributed partitioning, no coordinator
    auth_token=None,            # bearer for protected servers
    tls_ca_cert=None,           # path to PEM bundle for private CAs
)
for record_bytes in ds:
    record = orjson.loads(record_bytes)
    ...

Each __next__ returns one bytes record (no trailing newline). The stream opens lazily on first iter() and closes when the server runs out of records or --sample is exhausted.

PyTorch

from shuflr_client import IterableDataset
import torch

ds = IterableDataset(
    "http://localhost:9000/v1/streams/training",
    seed=42, shuffle="index-perm",
)
loader = torch.utils.data.DataLoader(ds, batch_size=128, num_workers=4)

When invoked from inside a DataLoader worker, IterableDataset reads torch.utils.data.get_worker_info() and auto-fills rank + world_size so each worker reads a disjoint slice of the shuffled stream — no per-worker config required.

A typical training data layer opens many Dataset instances at once (one per source corpus) and weights them with a wrapper layer; in production we sustain ~150 concurrent shuflr streams from a single training process this way.

Transports

Scheme Transport Status
http:// Plain HTTP/1.1 chunked NDJSON shipped
https:// HTTPS (ureq TLS) shipped — tls_ca_cert= for private CAs
shuflr:// shuflr-wire/1 over plain TCP shipped
shuflrs:// shuflr-wire/1 over TLS parses, lands next
shuflr+unix:// shuflr-wire/1 over UDS parses, lands next

HTTP is the universal fallback — works through any proxy, every firewall, every LB. The shuflr-wire/1 transport adds explicit framing and ordered delivery beyond what TCP gives you, plus raw-frame passthrough for chunk-shuffled mode: the server hands the client compressed seekable-zstd frames it then re-shuffles locally with the server-derived seed. Wire size shrinks to ~disk size (~3.6× less than NDJSON) at no quality cost.

Server

A shuflr serve instance hosts one or more named datasets:

shuflr serve --http 127.0.0.1:9000 \
    --dataset corpus=/data/corpus.jsonl.zst \
    --dataset pairs=/data/pairs.jsonl.zst

TLS, bearer / mTLS auth, and reloadable token files are all supported on the same listener. See the shuflr README for the full server-side surface.

Development

cd crates/shuflr-client
python3 -m venv .venv && source .venv/bin/activate
pip install maturin pytest
cargo build -p shuflr-cli --features serve   # tests spawn a real server
maturin develop --release
pytest tests/

Or run the bundled script: crates/shuflr-client/scripts/test.sh.

License

MIT OR Apache-2.0.

Metadata

Release files for shuflr-client 0.1.1

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 shuflr-client 0.1.1
File
shuflr_client-0.1.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
shuflr_client-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
shuflr_client-0.1.1-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
shuflr_client-0.1.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details

Total release size: 5.0 MB

Release files / shuflr_client-0.1.1-cp39-abi3-win_amd64.whl

Download URL shuflr_client-0.1.1-cp39-abi3-win_amd64.whl
Size 1.1 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f2cfb231d3d5659ae252dc543727c33b6720c6a6e66a7d3ed2cb7e5b0ceb7858
BLAKE2b-256 checksum
How to use checksums
fd30dfd9b28bbfbb6ccf2dc3f288518ee8d75718314c8e6808ceee94a441a3df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 30, 2026.

Transparency log

Release files / shuflr_client-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL shuflr_client-0.1.1-cp39-abi3-manylinux_2_28_x86_64.whl
Size 1.4 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
204ecbc751018da5c7f07f327e3733244447ff5323ae6ee99833a869f3bea589
BLAKE2b-256 checksum
How to use checksums
00744e8324d2970e0f249853ff1fffa20106d5e7a6aeff0070d96d1efb7431f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 30, 2026.

Transparency log

Release files / shuflr_client-0.1.1-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL shuflr_client-0.1.1-cp39-abi3-manylinux_2_28_aarch64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
677ae2004d6dd968e7888951697b305be48193c6be5b8b0bb5b48f4daa9e2525
BLAKE2b-256 checksum
How to use checksums
8f1475046828cf9c3afc7c4ea0b9129c805a510e6ed5c5fa1b0d6c75c5a3481a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 30, 2026.

Transparency log

Release files / shuflr_client-0.1.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL shuflr_client-0.1.1-cp39-abi3-macosx_11_0_arm64.whl
Size 1.2 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
720ed96b9838f22250594508e3d5f9d545d8364850006213592bacd5c479ed92
BLAKE2b-256 checksum
How to use checksums
e31cd74d695247d22e4696be14d81bea2b47299316d1f2228bfeaa321f753d05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Apr 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

4 release files

0.1.0

4 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