A simple peer-to-peer network using asyncio
Project description
ap2p
Overview
ap2p is a package designed to facilitate peer-to-peer communication and data exchange. It provides a robust and efficient framework for building decentralized applications.
Features
- No-nonsense API for peer-to-peer communication
- Asynchronicity with modern python3 async / await syntax
- Threading based on asyncio
- Ease of use with clear documentation and examples
- Easily extensible to accommodate various use cases
Installation
To install the package, use the following command:
pip install ap2p
Usage
Here's a basic example of how to use ap2p to start three interconnected nodes on localhost:
from asyncio import create_task, gather, run
from ipaddress import ip_address
from ap2p import Address, Node
LOCALHOST = ip_address("127.0.0.1")
PEERS = [
Address(LOCALHOST, 8000),
Address(LOCALHOST, 8001),
Address(LOCALHOST, 8002),
]
for peer in peers:
node = Node(address=peer)
create_task(node.start(peers=peers))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ap2p-0.0.1.tar.gz.
File metadata
- Download URL: ap2p-0.0.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1dc97473b6ddad5fec21ca2e2dd175565cdd41841bbe1f744000dd4c2a6429f
|
|
| MD5 |
9034075f6e554eff3917a4ee01884e96
|
|
| BLAKE2b-256 |
bbb4c765a849b7d7438baad33697d8d34985ebcafae92fe2207ff17b512105fd
|
File details
Details for the file ap2p-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ap2p-0.0.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daad700d47148d46fbd2dc36362ec14cc8b1f0f9d57fd793b830d77b8b11decc
|
|
| MD5 |
abda69530f66bee270c66d4e31fe09a8
|
|
| BLAKE2b-256 |
d4c1de826050a80c6a03de7ab0f1b6933d7674229b5a848d3a53e3b35f5b08db
|