Python bindings for the OUCH protocol
Project description
This package is python extension module for rust crate ouch_connect_nonblocking
Installation & Test
pytestexpectsouch_connectsource to be checked out from github. Test files are located in./bindings/python/testsdirectory.
micromamba create --name ouch_pypi_env --yes python &&
micromamba run --name ouch_pypi_env pip install "ouch-connect[test]>=5.0,<5.1" &&
micromamba run --name ouch_pypi_env pytest
Basic Usage Example
import logging
from time import sleep
from ouch_connect import CltAuto, SvcAuto
from links_connect.callbacks import LoggerCallback, DecoratorDriver, on_recv, on_sent, MemoryStoreCallback
logging.basicConfig(format="%(asctime)-15s [%(threadName)10s|%(levelname)8s] %(message)s \t%(filename)s:%(lineno)d")
logging.getLogger().setLevel(logging.INFO)
log = logging.getLogger(__name__)
addr = "127.0.0.1:8080"
class SimulatorExample(DecoratorDriver):
@on_recv({"Dbg": {}})
def on_dbg(self, con_id, msg):
self.sender.send({"Dbg": {"text": "Hello from Simulator"}})
@on_recv({})
def on_all_recv(self, con_id, msg):
pass
@on_sent({})
def on_all_sent(self, con_id, msg):
pass
store = MemoryStoreCallback()
clt_clbk = LoggerCallback(sent_level=logging.NOTSET) + store
svc_clbk = SimulatorExample() + store
with (
SvcAuto(addr, svc_clbk, **dict(name="svc-ouch")) as svc,
CltAuto(addr, clt_clbk, **dict(name="clt-ouch")) as clt,
):
assert clt.is_connected() and svc.is_connected()
log.info(f"svc: {svc}")
log.info(f"clt: {clt}")
clt.send({"Dbg": {"text": "Hello from Clt"}})
found = store.find_recv(name="svc-ouch", filter={"Dbg":{}})
assert found is not None and found.msg["Dbg"]["text"] == "Hello from Clt"
log.info(f"found: {found}")
found = store.find_recv(name="clt-ouch", filter={"Dbg":{}})
assert found is not None and found.msg["Dbg"]["text"] == "Hello from Simulator"
log.info(f"found: {found}")
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 Distributions
Built Distributions
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 ouch_connect-5.0.1-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: ouch_connect-5.0.1-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 680.9 kB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30e2aaebac53151b59f1c53e6b997fc1213d5c90d0d10e6868e14ac9d8898760
|
|
| MD5 |
a43577a55418c32069320de6da57a749
|
|
| BLAKE2b-256 |
b961ab48d6e7d92b55cdf84682bddef2ec072595e0dddda4bad7c1617f5cf17a
|
File details
Details for the file ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ac22ba683e64421f69412c165fb5be26d9c3e56ed0ef905e4b20a9f7388ecb3
|
|
| MD5 |
0cd2888b1728f2e1eba9e83346ae8fd4
|
|
| BLAKE2b-256 |
c0c32f3da184ba9b492f6acc5f9165d4bcc30e36f816174f13bf7ffe25ab4566
|
File details
Details for the file ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5bb31be82c8be9f1c3d66f063d14a9cc13a54a6368f1f10455d995d7ef6b1ef
|
|
| MD5 |
07cdf3ee1d8d0504065dab76aeaa4abd
|
|
| BLAKE2b-256 |
c7084cb2c41d16fc3e81a239fef0f645bc7e86a7236ada8bb683d51a6634431a
|
File details
Details for the file ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d266e4b622531ef105edc44d9a3e265b803f04e97b84eba15640630c9cb01ab
|
|
| MD5 |
eba1292bcd7b9ab87a9526fbebf967ba
|
|
| BLAKE2b-256 |
c99380cdfac872c5e12ff8616915d5f6ac913db8f72d8d87b9eae8b4bb3fe1ff
|
File details
Details for the file ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99e263c5f4f1fd7a1438894eb0c9ceb2b9534e778af15854e779ba02082da01e
|
|
| MD5 |
272b560b3859f0b6bf53721bbf8292aa
|
|
| BLAKE2b-256 |
4b45e2a07cbc73e766d36a82830bd06195d53b8ff0a99a693235e637679f8ec5
|
File details
Details for the file ouch_connect-5.0.1-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: ouch_connect-5.0.1-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 863.4 kB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3701e96c8128d52c2a0428917d0e8f2d96820055dabde3c3cdcce4eab1cfb0dc
|
|
| MD5 |
1d46ed47473aaf4f76aa97475ec632b7
|
|
| BLAKE2b-256 |
6946b945e4d3aa6bfd122a8b5a34d245e80a2349af4ed756b26e60166b400b98
|
File details
Details for the file ouch_connect-5.0.1-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: ouch_connect-5.0.1-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 857.2 kB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3bc82bee0e55f0d5411273fc3c8075319f89568cb65acd0e4877bc91bc35687
|
|
| MD5 |
7bbd5304bc7afadf2a8892e44120594b
|
|
| BLAKE2b-256 |
43a43606342474519cfb5227b8fd2dfddcc666d08f3e643db7e62fde6164e58f
|