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.0.tar.gz (58.5 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.0-cp312-cp312-win_amd64.whl (360.1 kB view details)

Uploaded CPython 3.12Windows x86-64

alwayson_py-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl (540.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

alwayson_py-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (550.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

alwayson_py-0.5.0-cp312-cp312-macosx_11_0_arm64.whl (479.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

alwayson_py-0.5.0-cp312-cp312-macosx_10_12_x86_64.whl (499.2 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for alwayson_py-0.5.0.tar.gz
Algorithm Hash digest
SHA256 25cc9b4de1c5a74bc9239edc525e4cf90156daf311aa923737cc1acdd7788348
MD5 d5d7d862e80508b6a76c8863b826929c
BLAKE2b-256 1ea6fd5ef8e1e008c8e389a720c0110937f2307bae092727f9bd0fdd80968195

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e7942ceccd66ad90bb1711dd3fe609424968e204b7b35e3bc6ef009cdd82f8a1
MD5 6a40c67316f952b1ad02ad809e2b1a70
BLAKE2b-256 cfb468b1d28d0ba7b80b8d89e703210094686af07867b19a57aee320754c58f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.5.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 383549dd277af03e31c91e46e65daae0d9fff4d0fa607695e5f59015a07ff9ed
MD5 9f11ed5f9674758a448aeb1ed419fc45
BLAKE2b-256 b6c9f469853e2ce0113eabd180fd4fb4b7602caeb4b70e7fc46bae3bc0edf44a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.5.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6f39509d9998bb3280e783820e0b6e7a1870c2fb94e649e8759f8e543586a13d
MD5 8548592ad88ee0b48b58553a9d337762
BLAKE2b-256 1fe62cf50d4d903ed427c33a544f4c0ff7a5a2fc69ff28233259b7f67e80c394

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d7d16e1fd5609bd062627e55de9b774163581dd11f47f135a3a9bb66bb11945d
MD5 96a4c9ff703036bf81cc5c6c453eeb53
BLAKE2b-256 44cb395588c29b7ec971c7475ede1249c1548ee4d6ce277ecfb3763ce18cadfc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.5.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 dd4100c764a4d875d6056e2b7d431d5610e2896c8daf4c7a32b84439d973b9e5
MD5 b202063a509a793c5f00825c7cacdb89
BLAKE2b-256 8f0bc9900059c0c6b386cd48d19f1a8e08392d945174d91d6023dd6982cf7c0b

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