UDPack
UDPack is a minimal Python wrapper around UDP sockets. It provides a single UDP class that acts as a full-duplex communication channel—bind an address to receive, specify a target to send, or do both.
Designed for lightweight robotics, networking utilities, and quick prototypes.
Installation
pip install udpack
Usage
import numpy as np
from udpack import UDP
# Full duplex: listen on 8000, send to 8001
udp = UDP(recv_addr=("0.0.0.0", 8000), send_addr=("127.0.0.1", 8001))
# Raw bytes
udp.send(b"hello")
data = udp.recv() # None on timeout
# Dict (JSON)
udp.send_dict({"x": 1.0, "y": 2.0})
obj = udp.recv_dict()
# NumPy arrays
udp.send_numpy(np.array([1, 2, 3], dtype=np.float32))
arr = udp.recv_numpy(dtype=np.float32)
udp.stop()
Constructor
recv_addr—(host, port)to bind and listen;Nonefor transmit-only.send_addr—(host, port)of the remote peer;Nonefor receive-only.
Timeouts
Pass timeout to recv, recv_dict, or recv_numpy:
None— blocking (wait forever)0— non-blocking (~0.1s poll)> 0— block for that many seconds
API
| Method | Description |
|---|---|
recv / send |
Raw bytes |
recv_dict / send_dict |
JSON-serialized dicts |
recv_numpy / send_numpy |
NumPy arrays (configurable dtype) |
stop |
Close the socket |
Release files for udpack 2026.3.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 | |
|---|---|---|---|
| udpack-2026.3.1.tar.gz | 103.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| udpack-2026.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 107.1 kB
Release files / udpack-2026.3.1.tar.gz
| Download URL | udpack-2026.3.1.tar.gz |
|---|---|
| Size | 103.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
014f63a6af2c4a2e977e2dd19f9cbe4ad1e3fb4a2894bee4c63f65f69f953214
|
|
BLAKE2b-256 checksum How to use checksums |
2935294d48c2eeb58028924e78300b575467900bd51045cccd18b206816e0cfb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|
Release files / udpack-2026.3.1-py3-none-any.whl
| Download URL | udpack-2026.3.1-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
242b7db0f75e48f74fa3b733c990f24ed9f538f3dfdc622a18faccf6edb67c2c
|
|
BLAKE2b-256 checksum How to use checksums |
8d5d07e6eddbb8ade220a60b880f794c8bf176fa2792944f442a18f206d28414
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.19
|