Skip to main content

Python bindings for ThingWorx AlwaysOn protocol encoding/decoding

Project description

AlwaysOn Python

License: MIT

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alwayson_py-0.5.1.tar.gz (58.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

alwayson_py-0.5.1-cp312-cp312-win_amd64.whl (357.3 kB view details)

Uploaded CPython 3.12Windows x86-64

alwayson_py-0.5.1-cp312-cp312-manylinux_2_28_aarch64.whl (539.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

alwayson_py-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (549.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

alwayson_py-0.5.1-cp312-cp312-macosx_11_0_arm64.whl (476.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

alwayson_py-0.5.1-cp312-cp312-macosx_10_12_x86_64.whl (497.3 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

Details for the file alwayson_py-0.5.1.tar.gz.

File metadata

  • Download URL: alwayson_py-0.5.1.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.9.4

File hashes

Hashes for alwayson_py-0.5.1.tar.gz
Algorithm Hash digest
SHA256 3e63ff1b0d49137990d247376629e14ac3bcfb5703d3ca27736757d084c054f8
MD5 e6aa1920ff75033739e7c47fead204d0
BLAKE2b-256 6d0514d6b0ae95c9ed1ca5055e06e5f433276d9f46eb6a9f763b835cca5a7e65

See more details on using hashes here.

File details

Details for the file alwayson_py-0.5.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for alwayson_py-0.5.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 eb415a63b555cf8a1b16b20ff636c35c46c2adc2abf6a0c0eaa3434ef4e91f38
MD5 26456b114645b11d57040fb251e5e59d
BLAKE2b-256 510e4c0b58ae852c402fe1545b9a41cad7e1af57576473b4d32d7d46fcf54ce9

See more details on using hashes here.

File details

Details for the file alwayson_py-0.5.1-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for alwayson_py-0.5.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a807c093ad4a6e9229d353d7cd3ea773294b61c0b79eaca96dbbb54a75e8c6ff
MD5 ea428b728fae0cf6c59eff84dafcc929
BLAKE2b-256 1823b2fde34d4e635ada21bf5e7edbfb12fac16aafbbf51234446b3f55735309

See more details on using hashes here.

File details

Details for the file alwayson_py-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for alwayson_py-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ba1f8f01df652c47a6388cba72de7a4052cfe6012af625a85dd0a5756a2a8816
MD5 b7aa30d0c4898da630e2db2d2510ea67
BLAKE2b-256 26c36e1fb81336b904f76b8a52fdedbc6ead5bf5e9e667f4605f5e897ba54263

See more details on using hashes here.

File details

Details for the file alwayson_py-0.5.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for alwayson_py-0.5.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a529f25749a3ab780cdbf43886ee02828159e5d750ed953d1498965d6a8c7a98
MD5 39fb700324bba93609e75839d64f1985
BLAKE2b-256 3ad2bf52c9d367b3edafa3d0dd5f6adb79d41c07db9c68a4ae1a6ff0f51d2dec

See more details on using hashes here.

File details

Details for the file alwayson_py-0.5.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for alwayson_py-0.5.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1d6303c926740f78c0c28e19d4d0d215412558ced8d1c3f13286131495a5cd02
MD5 84d1a9051bad2d50389a895d6461cb2f
BLAKE2b-256 be87d1e0c48d6d6b81ef94aa9207514088ed3607ff653567ca39697c8223ae97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page