Features
- Sans-I/O Architecture: Powered by an ownership-driven Rust state machine decoupled from an autonomous threaded reactor via a lock-free IPC boundary.
- Transport Primitives: Full implementation of bidirectional streams, unidirectional streams, and unreliable datagrams.
- Structured Concurrency: Deterministic lifecycle management for connections and streams via asynchronous context managers.
- Zero-Copy I/O: End-to-end support for buffer protocols and
memoryviewto minimize data copying overhead. - Application Framework: Declarative
ServerAppfeaturing path-based routing and composable stateful middleware.
Installation
pip install pywebtransport
Quick Start
Server
import asyncio
from pywebtransport import Event, ServerApp, ServerConfig, WebTransportSession, WebTransportStream
from pywebtransport.types import EventType
from pywebtransport.utils import generate_self_signed_cert
generate_self_signed_cert(hostname="localhost")
app = ServerApp(config=ServerConfig(certfile="localhost.crt", keyfile="localhost.key"))
@app.route(path="/")
async def echo_handler(session: WebTransportSession) -> None:
async def on_datagram(event: Event) -> None:
if isinstance(event.data, dict) and (data := event.data.get("data")):
await session.send_datagram(data=b"ECHO: " + data)
session.events.on(event_type=EventType.DATAGRAM_RECEIVED, handler=on_datagram)
try:
async for stream in session.incoming_bidirectional_streams():
asyncio.create_task(handle_stream(stream))
finally:
session.events.off(event_type=EventType.DATAGRAM_RECEIVED, handler=on_datagram)
async def handle_stream(stream: WebTransportStream) -> None:
try:
data = await stream.read_all()
await stream.write_all(data=b"ECHO: " + data, end_stream=True)
except Exception:
pass
if __name__ == "__main__":
app.run(host="127.0.0.1", port=4433)
Client
import asyncio
import ssl
from pywebtransport import ClientConfig, WebTransportClient
from pywebtransport.types import EventType
async def main() -> None:
config = ClientConfig(verify_mode=ssl.CERT_NONE)
async with WebTransportClient(config=config) as client:
session = await client.connect(url="https://127.0.0.1:4433/")
await session.send_datagram(data=b"Hello, Datagram!")
event = await session.events.wait_for(event_type=EventType.DATAGRAM_RECEIVED)
if isinstance(event.data, dict) and (data := event.data.get("data")):
print(f"Datagram: {data!r}")
stream = await session.create_bidirectional_stream()
await stream.write_all(data=b"Hello, Stream!", end_stream=True)
response = await stream.read_all()
print(f"Stream: {response!r}")
await session.close()
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
pass
Interoperability
Infrastructure
- Public Instance:
https://interop.wtransport.org, Native Dual-Stack - Container Image:
ghcr.io/wtransport/interop-server:latest, UDP Port 4433
Endpoints
- /echo: Bidirectional stream and datagram reflection.
- /stats: Current session statistics and negotiated parameters.
- /status: Global server health and aggregate metrics.
- /webtransport/devious-baton: Devious Baton protocol state transition validation.
Sponsors
License
Distributed under the terms of the Apache License 2.0. See LICENSE for details.
Metadata
Release files for pywebtransport 0.20.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pywebtransport-0.20.1.tar.gz | 779.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pywebtransport-0.20.1-cp312-abi3-win_arm64.whl | CPython 3.12 | abi3 | Windows ARM64 | Details |
| pywebtransport-0.20.1-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| pywebtransport-0.20.1-cp312-abi3-manylinux_2_34_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.34+ x86-64 | Details |
| pywebtransport-0.20.1-cp312-abi3-manylinux_2_34_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.34+ ARM64 | Details |
| pywebtransport-0.20.1-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl | CPython 3.12 | abi3 | macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64, macOS 11.0+ ARM64 | Details |
Total release size: 14.9 MB
Release files / pywebtransport-0.20.1.tar.gz
| Download URL | pywebtransport-0.20.1.tar.gz |
|---|---|
| Size | 779.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
570fd1fa08f3cd0c67b4e56fd8ad5ba729d2edb6dbaecebd05184af762e18eea
|
|
BLAKE2b-256 checksum How to use checksums |
b4e3dc6f1549eaabb868b899975a36e777bd11834165c06d3a49a2a371b44fe5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 22, 2026.
Transparency logRelease files / pywebtransport-0.20.1-cp312-abi3-win_arm64.whl
| Download URL | pywebtransport-0.20.1-cp312-abi3-win_arm64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.12 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
260a2d8254590b5dbb5d0bde8012118c499e5d72f108e8e63a39d82ef004db4c
|
|
BLAKE2b-256 checksum How to use checksums |
36c73494da5de7bfaddc542d3dfeb4ea4962ad3e78c4cf503e8b70331d723b13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 22, 2026.
Transparency logRelease files / pywebtransport-0.20.1-cp312-abi3-win_amd64.whl
| Download URL | pywebtransport-0.20.1-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
988882fde84554d01f6d98f417d4674150fc63e3c31f76dc2f2bfdd6aadc8df8
|
|
BLAKE2b-256 checksum How to use checksums |
a09852248ca1851d78c6447766321423a37e5d9d2cd3f79b50c792e1160781ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 22, 2026.
Transparency logRelease files / pywebtransport-0.20.1-cp312-abi3-manylinux_2_34_x86_64.whl
| Download URL | pywebtransport-0.20.1-cp312-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e5a02ea74cea2e61e9864d18c21b5b608e0070021e513fe0c7bb860170ed2114
|
|
BLAKE2b-256 checksum How to use checksums |
d050040d18e10dea4592ed652893d0dd464ea8d618c000e5422922fd75440eee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 22, 2026.
Transparency logRelease files / pywebtransport-0.20.1-cp312-abi3-manylinux_2_34_aarch64.whl
| Download URL | pywebtransport-0.20.1-cp312-abi3-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
cfc16c73dc5c6c6222f3ecf56f887c97df1c4d936685e0b2456c57d3a0b01343
|
|
BLAKE2b-256 checksum How to use checksums |
66d614639f42f2e45708276a73809a7a5c08006b07496acd62f4ddabdf7913a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 22, 2026.
Transparency logRelease files / pywebtransport-0.20.1-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | pywebtransport-0.20.1-cp312-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 4.6 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
74025f8709e2e4386d30e0f37ba0ca94679706939f2b51aecd20d9b503ebfc71
|
|
BLAKE2b-256 checksum How to use checksums |
6c1c69891e99750cdb6d8b56f2f98179af19208ab9a8564220da2aab8d8c3e4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 22, 2026.
Transparency log