This package is python extension module for rust crate [ouch_connect_nonblocking](./../../connect/nonblocking/readme.md)
## Installation & Test
* `pytest` expects `ouch_connect` source to be checked out from github. Test files are located in `./bindings/python/tests` directory.
```shell
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
```python
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}")
```
Raw data
{
"_id": null,
"home_page": null,
"name": "ouch-connect",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "exchange,protocol",
"author": "Softstream <softstream.link@gmail.com>",
"author_email": "Softstream <softstream.link@gmail.com>",
"download_url": null,
"platform": null,
"description": "This package is python extension module for rust crate [ouch_connect_nonblocking](./../../connect/nonblocking/readme.md)\n\n## Installation & Test\n* `pytest` expects `ouch_connect` source to be checked out from github. Test files are located in `./bindings/python/tests` directory.\n\n```shell\nmicromamba create --name ouch_pypi_env --yes python &&\nmicromamba run --name ouch_pypi_env pip install \"ouch-connect[test]>=5.0,<5.1\" &&\nmicromamba run --name ouch_pypi_env pytest\n```\n\n\n## Basic Usage Example\n```python\nimport logging\nfrom time import sleep\nfrom ouch_connect import CltAuto, SvcAuto\nfrom links_connect.callbacks import LoggerCallback, DecoratorDriver, on_recv, on_sent, MemoryStoreCallback\n\n\nlogging.basicConfig(format=\"%(asctime)-15s [%(threadName)10s|%(levelname)8s] %(message)s \\t%(filename)s:%(lineno)d\")\nlogging.getLogger().setLevel(logging.INFO)\nlog = logging.getLogger(__name__)\naddr = \"127.0.0.1:8080\"\n\nclass SimulatorExample(DecoratorDriver):\n @on_recv({\"Dbg\": {}})\n def on_dbg(self, con_id, msg):\n self.sender.send({\"Dbg\": {\"text\": \"Hello from Simulator\"}})\n\n @on_recv({})\n def on_all_recv(self, con_id, msg):\n pass\n\n @on_sent({})\n def on_all_sent(self, con_id, msg):\n pass\n\nstore = MemoryStoreCallback()\nclt_clbk = LoggerCallback(sent_level=logging.NOTSET) + store\nsvc_clbk = SimulatorExample() + store\nwith (\n SvcAuto(addr, svc_clbk, **dict(name=\"svc-ouch\")) as svc,\n CltAuto(addr, clt_clbk, **dict(name=\"clt-ouch\")) as clt,\n):\n assert clt.is_connected() and svc.is_connected()\n\n log.info(f\"svc: {svc}\")\n log.info(f\"clt: {clt}\")\n\n clt.send({\"Dbg\": {\"text\": \"Hello from Clt\"}})\n\n found = store.find_recv(name=\"svc-ouch\", filter={\"Dbg\":{}})\n assert found is not None and found.msg[\"Dbg\"][\"text\"] == \"Hello from Clt\"\n log.info(f\"found: {found}\")\n\n found = store.find_recv(name=\"clt-ouch\", filter={\"Dbg\":{}})\n assert found is not None and found.msg[\"Dbg\"][\"text\"] == \"Hello from Simulator\"\n log.info(f\"found: {found}\")\n```\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Python bindings for the OUCH protocol",
"version": "5.0.1",
"project_urls": {
"Source Code": "https://github.com/softstream-link/ouch"
},
"split_keywords": [
"exchange",
"protocol"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "43a43606342474519cfb5227b8fd2dfddcc666d08f3e643db7e62fde6164e58f",
"md5": "7bbd5304bc7afadf2a8892e44120594b",
"sha256": "d3bc82bee0e55f0d5411273fc3c8075319f89568cb65acd0e4877bc91bc35687"
},
"downloads": -1,
"filename": "ouch_connect-5.0.1-cp310-abi3-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "7bbd5304bc7afadf2a8892e44120594b",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.11",
"size": 857236,
"upload_time": "2024-02-26T22:51:37",
"upload_time_iso_8601": "2024-02-26T22:51:37.700468Z",
"url": "https://files.pythonhosted.org/packages/43/a4/3606342474519cfb5227b8fd2dfddcc666d08f3e643db7e62fde6164e58f/ouch_connect-5.0.1-cp310-abi3-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "6946b945e4d3aa6bfd122a8b5a34d245e80a2349af4ed756b26e60166b400b98",
"md5": "1d46ed47473aaf4f76aa97475ec632b7",
"sha256": "3701e96c8128d52c2a0428917d0e8f2d96820055dabde3c3cdcce4eab1cfb0dc"
},
"downloads": -1,
"filename": "ouch_connect-5.0.1-cp310-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "1d46ed47473aaf4f76aa97475ec632b7",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.11",
"size": 863426,
"upload_time": "2024-02-26T22:51:40",
"upload_time_iso_8601": "2024-02-26T22:51:40.095376Z",
"url": "https://files.pythonhosted.org/packages/69/46/b945e4d3aa6bfd122a8b5a34d245e80a2349af4ed756b26e60166b400b98/ouch_connect-5.0.1-cp310-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4b45e2a07cbc73e766d36a82830bd06195d53b8ff0a99a693235e637679f8ec5",
"md5": "272b560b3859f0b6bf53721bbf8292aa",
"sha256": "99e263c5f4f1fd7a1438894eb0c9ceb2b9534e778af15854e779ba02082da01e"
},
"downloads": -1,
"filename": "ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "272b560b3859f0b6bf53721bbf8292aa",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.11",
"size": 1727801,
"upload_time": "2024-02-26T22:51:42",
"upload_time_iso_8601": "2024-02-26T22:51:42.391918Z",
"url": "https://files.pythonhosted.org/packages/4b/45/e2a07cbc73e766d36a82830bd06195d53b8ff0a99a693235e637679f8ec5/ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c99380cdfac872c5e12ff8616915d5f6ac913db8f72d8d87b9eae8b4bb3fe1ff",
"md5": "eba1292bcd7b9ab87a9526fbebf967ba",
"sha256": "4d266e4b622531ef105edc44d9a3e265b803f04e97b84eba15640630c9cb01ab"
},
"downloads": -1,
"filename": "ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"has_sig": false,
"md5_digest": "eba1292bcd7b9ab87a9526fbebf967ba",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.11",
"size": 1816011,
"upload_time": "2024-02-26T22:51:44",
"upload_time_iso_8601": "2024-02-26T22:51:44.984300Z",
"url": "https://files.pythonhosted.org/packages/c9/93/80cdfac872c5e12ff8616915d5f6ac913db8f72d8d87b9eae8b4bb3fe1ff/ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c7084cb2c41d16fc3e81a239fef0f645bc7e86a7236ada8bb683d51a6634431a",
"md5": "07cdf3ee1d8d0504065dab76aeaa4abd",
"sha256": "e5bb31be82c8be9f1c3d66f063d14a9cc13a54a6368f1f10455d995d7ef6b1ef"
},
"downloads": -1,
"filename": "ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"has_sig": false,
"md5_digest": "07cdf3ee1d8d0504065dab76aeaa4abd",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.11",
"size": 2030355,
"upload_time": "2024-02-26T22:51:47",
"upload_time_iso_8601": "2024-02-26T22:51:47.551654Z",
"url": "https://files.pythonhosted.org/packages/c7/08/4cb2c41d16fc3e81a239fef0f645bc7e86a7236ada8bb683d51a6634431a/ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c0c32f3da184ba9b492f6acc5f9165d4bcc30e36f816174f13bf7ffe25ab4566",
"md5": "0cd2888b1728f2e1eba9e83346ae8fd4",
"sha256": "2ac22ba683e64421f69412c165fb5be26d9c3e56ed0ef905e4b20a9f7388ecb3"
},
"downloads": -1,
"filename": "ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "0cd2888b1728f2e1eba9e83346ae8fd4",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.11",
"size": 1706121,
"upload_time": "2024-02-26T22:51:49",
"upload_time_iso_8601": "2024-02-26T22:51:49.328340Z",
"url": "https://files.pythonhosted.org/packages/c0/c3/2f3da184ba9b492f6acc5f9165d4bcc30e36f816174f13bf7ffe25ab4566/ouch_connect-5.0.1-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "b961ab48d6e7d92b55cdf84682bddef2ec072595e0dddda4bad7c1617f5cf17a",
"md5": "a43577a55418c32069320de6da57a749",
"sha256": "30e2aaebac53151b59f1c53e6b997fc1213d5c90d0d10e6868e14ac9d8898760"
},
"downloads": -1,
"filename": "ouch_connect-5.0.1-cp310-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "a43577a55418c32069320de6da57a749",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.11",
"size": 680860,
"upload_time": "2024-02-26T22:51:51",
"upload_time_iso_8601": "2024-02-26T22:51:51.582898Z",
"url": "https://files.pythonhosted.org/packages/b9/61/ab48d6e7d92b55cdf84682bddef2ec072595e0dddda4bad7c1617f5cf17a/ouch_connect-5.0.1-cp310-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-26 22:51:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "softstream-link",
"github_project": "ouch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ouch-connect"
}