Python client node for Ubi-Interact
Project description
Python client node v.2 for Ubi-Interact
This is the package for the python client node v2 for the Ubi-Interact framework
Requirements and installation
- Tested for:
- Linux and Windows
- Python 3.10, 3.12
Installation with pip
$ pip install ubii-node-python-2
How to use
- Import the UbiiClientNode module and instanciate the client node
from ubii.ubii_client_node import UbiiClientNode node = UbiiClientNode('pythonNodev2', 'http://localhost:8102/services/binary', 'ws://localhost:8104')
- Use the node to make service calls, subscribe to topics, publish topic data
request = ServiceRequest() request.topic = '/services/topic_list' response = self.node.call_service(request) topicDataRecord = TopicDataRecord() topicDataRecord.topic = 'testTopic' node.publish(topicDataRecord) def printTopicDataRecord(record): print(record) node.subscribeTopic('testTopic', printTopicDataRecord) node.stopNode()
- For more information on the module check the documentation (index.html)
ubii-msg-formats
To communicate with the masternode the client node uses protocol buffers. The framework provides a number of protobuf message definitions, to update to the newest message definitions with pip use:
$ pip install --upgrade ubii-msg-formats
Testing
test the published package
once:
virtualenv venv
source venv/bin/activate (linux) OR .\venv\Scripts\Activate.ps1 (windows)
pip install Ubii-Python-Node-v2
every time:
source venv/bin/activate (if not active)
python test/test.py
test local code
Setup:
python -m virtualenv venv-testsrc
source venv-testsrc/bin/activate (linux) OR .\venv-testsrc\Scripts\Activate.ps1 (windows)
pip install -e .
python ./testing/runTests.py (linux) OR python .\testing\runTests.py (windows)
Building
python3 -m pip install --upgrade build
python3 -m build / py -m build
Bugs
- There is a problem in python 3.9 and 3.10 where starting threads while the interpreter shuts down can lead to a RuntimeError: 'cannot schedule new futures after interpreter shutdown'. If this occurs one quck fix is to add a time.sleep to the end of the main file.
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 ubii_node_python_2-0.1.0.tar.gz.
File metadata
- Download URL: ubii_node_python_2-0.1.0.tar.gz
- Upload date:
- Size: 2.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c7c8100dfa16de23fff0204b7f7da782828fe308aba5e19655312b79b2201e4
|
|
| MD5 |
3acb266414edc6257e22639657438bf0
|
|
| BLAKE2b-256 |
f0ac581234cbecfd84fee7e9815065f334c0fbb0e35ae35aa2208b4fbb1d2d8f
|
File details
Details for the file ubii_node_python_2-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ubii_node_python_2-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be4155359f8f0039ac2b2bc181397aa68d8a99b4851102f02be70a0c8055bb4d
|
|
| MD5 |
42eb574f6f6225661ab855072ddc1f85
|
|
| BLAKE2b-256 |
0a016a29719456111265220ec5d70ac37e7c4a6e4f69d1dd2465b154748f9d50
|