
py-setowire — lightweight P2P library for Python, no broker, no central server
Built a minimal P2P networking library in Python. UDP-based — peers find each other directly, no central server needed.
git clone https://github.com/setowire-org/py-setowire
pip install cryptography
python -m chat alice myroom
**What My Project Does**
Setowire lets peers discover and connect to each other over UDP without any broker or central server. Discovery runs DHT, piping servers for strict NATs, LAN multicast, and HTTP bootstrap in parallel — whichever works first wins. All traffic is encrypted end-to-end with X25519 + ChaCha20-Poly1305. Only one dependency: `cryptography`. Everything else is stdlib.
**Target Audience**
Experimental / toy project for now. Good starting point if you want to understand how P2P networking works without a heavy framework in the way. The protocol is simple enough to reimplement in other languages — there's already a wire-compatible JS version.
**Comparison**
Most Python P2P libs (like libp2p) pull in a ton of dependencies and abstract everything away. Setowire is ~1000 lines total across 8 files. You can read the whole thing in an afternoon.