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.6.0.tar.gz (89.8 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.6.0-cp312-cp312-win_amd64.whl (372.9 kB view details)

Uploaded CPython 3.12Windows x86-64

alwayson_py-0.6.0-cp312-cp312-manylinux_2_28_aarch64.whl (556.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

alwayson_py-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (562.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

alwayson_py-0.6.0-cp312-cp312-macosx_11_0_arm64.whl (492.7 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

alwayson_py-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl (509.5 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for alwayson_py-0.6.0.tar.gz
Algorithm Hash digest
SHA256 8565cac9b66d3736bc26ea7a2c045fa7529f435c6bf3a8f7d7f259f3122f4aa5
MD5 7658919ca1aae5b0019da5955d385f4e
BLAKE2b-256 e9e24d022e1856f5993ae5cb603004cb66b889f2bb720b15c7f664ef7de43d8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.6.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e3dcfe732f82d6838e7c8fb2b841072f0ff26d8c8419a792b3f7965fc06f79c3
MD5 f1096fb334a41a1bf6d9c493a472d8a2
BLAKE2b-256 bef411add26d89f88b636354a9dbf10b717fd3d352007bc7acde50f17302294e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.6.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 83a745201be99d4c1d4eb328c78996ab2256973029cb6fe19cc7c10b6f276e10
MD5 63a538187b8b82b356b38117b14e4b22
BLAKE2b-256 1c0a90c0f0226b5a2c8f5a001d284feaf74d5f2ea3ea162727514d3aeed2d438

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c842eb037def66bf8f4ea2c8ced030d7e156cff0cd5a78e06cbd9abe09532a41
MD5 3d2a963b8ddf6c1e5ea952172cdb099c
BLAKE2b-256 c43b17b0ce56e9c922a98db247e9c0fb9ec1777bf353d9d4e8502c31686a616a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.6.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 848598ed6e689e26c00af475c95aebb9f944ce635e36bac0532b8621ea0a79d3
MD5 cb4fce9e0a963f481f62c61c412990dd
BLAKE2b-256 d1ecdb2b67e7d3310b2fd8e352ad1869bf3109d0a4fbbbab602d1a3216e993a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 b05cb92979d9662703b0f04ad2a36db18c868598a3237aa9b68b2961bf02f740
MD5 9dca82dffd50d4f14e6899c6c4d14b8b
BLAKE2b-256 6ae3c22fb3a72aff6aab50059ddbc4b40699c1f65993cb3c9c3c59dd8c47e2ef

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