AlwaysOn Python
Python bindings for the ThingWorx AlwaysOn protocol codec, enabling efficient encoding and decoding of ThingWorx AlwaysOn protocol messages in Python.
Note: The underlying Rust crates (
alwayson-codec) are not yet open source. This Python library is currently delivered as pre-compiled binary wheels only.
Features
- 🚀 High Performance - Rust-powered encoding/decoding
- 🐍 Pythonic API - Familiar Python interfaces
- 📦 Zero Dependencies - Self-contained binary wheels
- 🔧 Complete Protocol Support - All ThingWorx primitive types and messages
- 🛡️ Type Safety - Comprehensive type hints
- 📊 Multipart Messages - Handle large message splitting/merging
Installation
pip install alwayson-py
Quick Start
import alwayson
# Create primitive values
string_value = alwayson.TwPrim.string("Hello World")
number_value = alwayson.TwPrim.number(42.5)
boolean_value = alwayson.TwPrim.boolean(True)
# Serialize to JSON or binary
json_data = string_value.to_json()
binary_data = string_value.to_bytes()
# Create an authentication message
auth_msg = alwayson.TwxMessage.build_auth(12345, "your-app-key")
binary_msg = auth_msg.to_bytes()
# Parse binary messages
parsed_msg = alwayson.TwxMessage.from_bytes(binary_msg)
print(f"Message type: {parsed_msg.get_message_type()}")
# Work with InfoTables - decode from binary
binary_infotable = bytes.fromhex("010974696d657374616d70...") # Example binary data
infotable = alwayson.InfoTable.from_bytes(binary_infotable)
print(f"InfoTable has {infotable.get_row_count()} rows, {infotable.get_field_count()} fields")
# Convert InfoTable to JSON
json_representation = infotable.to_json()
print(json_representation)
# Create empty InfoTable
empty_table = alwayson.TwPrim.infotable_empty()
print(f"Type: {empty_table.get_type()}") # Returns "INFOTABLE"
Development
This project is built with PyO3 and maturin.
Setup
# Clone the repository
git clone https://github.com/xudesheng/alwayson_py.git
cd alwayson_py
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install maturin
pip install maturin[patchelf]
# Development build
maturin develop
Testing
pip install pytest pytest-asyncio
pytest tests/
Related Projects
alwayson-codec- The underlying Rust codec library (not yet open source)alwayson-base- Full ThingWorx client implementation (not yet open source)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
Desheng Xu xudesheng@gmail.com
Metadata
Release files for alwayson-py 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alwayson_py-0.6.0.tar.gz | 89.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| alwayson_py-0.6.0-cp312-cp312-win_amd64.whl | CPython 3.12 | CPython 3.12 | Windows x86-64 | Details |
| alwayson_py-0.6.0-cp312-cp312-manylinux_2_28_aarch64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.28+ ARM64 | Details |
| alwayson_py-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.12 | CPython 3.12 | Linux glibc 2.17+ x86-64 | Details |
| alwayson_py-0.6.0-cp312-cp312-macosx_11_0_arm64.whl | CPython 3.12 | CPython 3.12 | macOS 11.0+ ARM64 | Details |
| alwayson_py-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl | CPython 3.12 | CPython 3.12 | macOS 10.12+ x86-64 | Details |
Total release size: 2.6 MB
Release files / alwayson_py-0.6.0.tar.gz
| Download URL | alwayson_py-0.6.0.tar.gz |
|---|---|
| Size | 89.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8565cac9b66d3736bc26ea7a2c045fa7529f435c6bf3a8f7d7f259f3122f4aa5
|
|
BLAKE2b-256 checksum How to use checksums |
e9e24d022e1856f5993ae5cb603004cb66b889f2bb720b15c7f664ef7de43d8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / alwayson_py-0.6.0-cp312-cp312-win_amd64.whl
| Download URL | alwayson_py-0.6.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 372.9 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e3dcfe732f82d6838e7c8fb2b841072f0ff26d8c8419a792b3f7965fc06f79c3
|
|
BLAKE2b-256 checksum How to use checksums |
bef411add26d89f88b636354a9dbf10b717fd3d352007bc7acde50f17302294e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / alwayson_py-0.6.0-cp312-cp312-manylinux_2_28_aarch64.whl
| Download URL | alwayson_py-0.6.0-cp312-cp312-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 556.6 kB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
83a745201be99d4c1d4eb328c78996ab2256973029cb6fe19cc7c10b6f276e10
|
|
BLAKE2b-256 checksum How to use checksums |
1c0a90c0f0226b5a2c8f5a001d284feaf74d5f2ea3ea162727514d3aeed2d438
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / alwayson_py-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | alwayson_py-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 562.2 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c842eb037def66bf8f4ea2c8ced030d7e156cff0cd5a78e06cbd9abe09532a41
|
|
BLAKE2b-256 checksum How to use checksums |
c43b17b0ce56e9c922a98db247e9c0fb9ec1777bf353d9d4e8502c31686a616a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / alwayson_py-0.6.0-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | alwayson_py-0.6.0-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 492.7 kB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
848598ed6e689e26c00af475c95aebb9f944ce635e36bac0532b8621ea0a79d3
|
|
BLAKE2b-256 checksum How to use checksums |
d1ecdb2b67e7d3310b2fd8e352ad1869bf3109d0a4fbbbab602d1a3216e993a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|
Release files / alwayson_py-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl
| Download URL | alwayson_py-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl |
|---|---|
| Size | 509.5 kB |
| Tags | CPython 3.12 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
b05cb92979d9662703b0f04ad2a36db18c868598a3237aa9b68b2961bf02f740
|
|
BLAKE2b-256 checksum How to use checksums |
6ae3c22fb3a72aff6aab50059ddbc4b40699c1f65993cb3c9c3c59dd8c47e2ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.9.4
|