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.4.0.tar.gz (57.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.4.0-cp312-cp312-win_amd64.whl (357.2 kB view details)

Uploaded CPython 3.12Windows x86-64

alwayson_py-0.4.0-cp312-cp312-manylinux_2_28_aarch64.whl (538.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

alwayson_py-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (547.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

alwayson_py-0.4.0-cp312-cp312-macosx_11_0_arm64.whl (476.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

alwayson_py-0.4.0-cp312-cp312-macosx_10_12_x86_64.whl (496.3 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for alwayson_py-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ae3d292a78a66d4941faf3e36023e8d8a62e97165be9dc9acc75e737fa0b4a0e
MD5 c3faea1992edd2430f26c3a3d27dbf53
BLAKE2b-256 de62784a4399640535efa6dcf8d2c774036fa2cb0f807c032e56e65db1312fb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8d426609474b722c38a67d8c47c7474d25cc2eefaf0f669af939701305ca2efd
MD5 a2b0df04f6f4d4494bce393f03728371
BLAKE2b-256 2571d14410900fc81d0b42165a5778e03f47b29fe59c360f50079c5a58b4074d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.4.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f786931f40b83b77eef9fdb846fc9b4789ffb201257c240529cc7d56c5020e01
MD5 dd9b3aaf6300252e5a01a6badf97d857
BLAKE2b-256 71ebb5da4df185d93f30cd0699053072cbafc24761748331746ce7af90826dcc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5dd7b1ee3f548e9a171b3d3ceb3b09bcf69f9432f75bfb95fb1e8eb67e46fe41
MD5 2c44061a0796a8ff4d67e06120d1dd41
BLAKE2b-256 af4b33f0b160ddb58030b36e66b83ba272dd03060e1e9ab21831e4dbc68f64d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a52832ec81cccf2a75c59ecee521c114122de5c0b3b93a2486cd4b1b0c8724d7
MD5 0ac21d36e59499c55b07cbfdfd6c0040
BLAKE2b-256 352bae9b878da2677e761e6bb43562cc7d70da2e7b3ac0b661ea80c26ef24fe4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for alwayson_py-0.4.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a622ef9e8b9414b868961ca4cddff5ecd0bca7fa778647090432c0dbefd6c747
MD5 bd9bdb5e5c6e6178ad8f2442abc73e23
BLAKE2b-256 e90a61bca41ae446f8ddb5d2e06054cc4a0bc5666aec71c1cba2a3a9da9d9695

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