A Sans-I/O Python client library for Brultech Devices
Project description
What is siobrultech-protocols?
This library is a collection of protcols that decode various packet formats from Brultech Research.
What is Sans-I/O?
Sans-I/O is a philosophy for developing protocol processing libraries in which the library does not do any I/O. Instead, a user of the library is responsible for transferring blocks of bytes between the socket or pipe and the protocol library, and for receiving application-level protocol items from and sending them to the library. This obviously makes a sans-I/O library a little more difficult to use, but comes with the advantage that the same library can be used with any I/O and concurrency mechanism: the same library should be usable in a single-request-at-a-time server, a process-per-request or thread-per-request blocking server, a server using select/poll and continuations, or a server using asyncio, Twisted, or any other asynchronous framework.
See SansIO for more information.
Installation
pip install siobrultech-protocols
Usage
import functools
from siobrultech_protocols.gem.protocols import PacketProtocol
# Queue to get recieved packets from.
queue = asyncio.Queue()
# Pass this Protocol to whatever recieves data from the device.
protocol_factory = functools.partial(PacketProtocol, queue=queue)
Take a look at some usage examples from libraries that use this.
Development
Setup
python3.9 -m venv .venv
source .venv/bin/activate
# Install Requirements
pip install -r requirements.txt
# Install Dev Requirements
pip install -r requirements-dev.txt
# One-Time Install of Commit Hooks
pre-commit install
Testing
Tests are run with pytest
.
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
Hashes for siobrultech-protocols-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ca2954d7dba2ca7395359f87b393ea39b24b1018bd6b19c044c03f06494b286 |
|
MD5 | aa37087ccaf509d9da7403a062d08bf3 |
|
BLAKE2b-256 | be9b352f27083e5143b2b92a1fe7696038f9c3163ab84d53fbaea63c006ce72f |
Hashes for siobrultech_protocols-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8db9e119952398b56b06dd43ed9a8263ff977318e861b4d440986f57454a81e7 |
|
MD5 | bb16eb8233e435caf9977c7ffd2dcb0e |
|
BLAKE2b-256 | abe49a24b46c31a82b8198b0cc0f81cddce1af4fa78270cb3ab0d22a38e1d974 |