# AlwaysOn Python
[](https://opensource.org/licenses/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
```bash
pip install alwayson-py
```
## Quick Start
```python
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](https://pyo3.rs/) and [maturin](https://github.com/PyO3/maturin).
### Setup
```bash
# 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
```bash
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](LICENSE) file for details.
## Author
**Desheng Xu** <xudesheng@gmail.com>
Raw data
{
"_id": null,
"home_page": "https://github.com/xudesheng/alwayson_py",
"name": "alwayson-py",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "thingworx, iot, protocol, alwayson, codec",
"author": null,
"author_email": "Desheng Xu <xudesheng@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e9/e2/4d022e1856f5993ae5cb603004cb66b889f2bb720b15c7f664ef7de43d8b/alwayson_py-0.6.0.tar.gz",
"platform": null,
"description": "# AlwaysOn Python\n\n[](https://opensource.org/licenses/MIT)\n\nPython bindings for the ThingWorx AlwaysOn protocol codec, enabling efficient encoding and decoding of ThingWorx AlwaysOn protocol messages in Python.\n\n> **Note**: The underlying Rust crates (`alwayson-codec`) are not yet open source. This Python library is currently delivered as pre-compiled binary wheels only.\n\n## Features\n\n- \ud83d\ude80 **High Performance** - Rust-powered encoding/decoding\n- \ud83d\udc0d **Pythonic API** - Familiar Python interfaces\n- \ud83d\udce6 **Zero Dependencies** - Self-contained binary wheels\n- \ud83d\udd27 **Complete Protocol Support** - All ThingWorx primitive types and messages\n- \ud83d\udee1\ufe0f **Type Safety** - Comprehensive type hints\n- \ud83d\udcca **Multipart Messages** - Handle large message splitting/merging\n\n## Installation\n\n```bash\npip install alwayson-py\n```\n\n## Quick Start\n\n```python\nimport alwayson\n\n# Create primitive values\nstring_value = alwayson.TwPrim.string(\"Hello World\")\nnumber_value = alwayson.TwPrim.number(42.5)\nboolean_value = alwayson.TwPrim.boolean(True)\n\n# Serialize to JSON or binary\njson_data = string_value.to_json()\nbinary_data = string_value.to_bytes()\n\n# Create an authentication message\nauth_msg = alwayson.TwxMessage.build_auth(12345, \"your-app-key\")\nbinary_msg = auth_msg.to_bytes()\n\n# Parse binary messages\nparsed_msg = alwayson.TwxMessage.from_bytes(binary_msg)\nprint(f\"Message type: {parsed_msg.get_message_type()}\")\n\n# Work with InfoTables - decode from binary\nbinary_infotable = bytes.fromhex(\"010974696d657374616d70...\") # Example binary data\ninfotable = alwayson.InfoTable.from_bytes(binary_infotable)\nprint(f\"InfoTable has {infotable.get_row_count()} rows, {infotable.get_field_count()} fields\")\n\n# Convert InfoTable to JSON\njson_representation = infotable.to_json()\nprint(json_representation)\n\n# Create empty InfoTable\nempty_table = alwayson.TwPrim.infotable_empty()\nprint(f\"Type: {empty_table.get_type()}\") # Returns \"INFOTABLE\"\n```\n\n## Development\n\nThis project is built with [PyO3](https://pyo3.rs/) and [maturin](https://github.com/PyO3/maturin).\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/xudesheng/alwayson_py.git\ncd alwayson_py\n\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate # Windows: venv\\Scripts\\activate\n\n# Install maturin\npip install maturin[patchelf]\n\n# Development build\nmaturin develop\n```\n\n### Testing\n\n```bash\npip install pytest pytest-asyncio\npytest tests/\n```\n\n## Related Projects\n\n- `alwayson-codec` - The underlying Rust codec library (not yet open source)\n- `alwayson-base` - Full ThingWorx client implementation (not yet open source)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\n**Desheng Xu** <xudesheng@gmail.com>\n",
"bugtrack_url": null,
"license": null,
"summary": "Python bindings for ThingWorx AlwaysOn protocol encoding/decoding",
"version": "0.6.0",
"project_urls": {
"Bug Tracker": "https://github.com/xudesheng/alwayson_py/issues",
"Documentation": "https://github.com/xudesheng/alwayson_py/blob/main/README.md",
"Homepage": "https://github.com/xudesheng/alwayson_py",
"Repository": "https://github.com/xudesheng/alwayson_py"
},
"split_keywords": [
"thingworx",
" iot",
" protocol",
" alwayson",
" codec"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "6ae3c22fb3a72aff6aab50059ddbc4b40699c1f65993cb3c9c3c59dd8c47e2ef",
"md5": "9dca82dffd50d4f14e6899c6c4d14b8b",
"sha256": "b05cb92979d9662703b0f04ad2a36db18c868598a3237aa9b68b2961bf02f740"
},
"downloads": -1,
"filename": "alwayson_py-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl",
"has_sig": false,
"md5_digest": "9dca82dffd50d4f14e6899c6c4d14b8b",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 509508,
"upload_time": "2025-09-05T04:11:28",
"upload_time_iso_8601": "2025-09-05T04:11:28.704732Z",
"url": "https://files.pythonhosted.org/packages/6a/e3/c22fb3a72aff6aab50059ddbc4b40699c1f65993cb3c9c3c59dd8c47e2ef/alwayson_py-0.6.0-cp312-cp312-macosx_10_12_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d1ecdb2b67e7d3310b2fd8e352ad1869bf3109d0a4fbbbab602d1a3216e993a7",
"md5": "cb4fce9e0a963f481f62c61c412990dd",
"sha256": "848598ed6e689e26c00af475c95aebb9f944ce635e36bac0532b8621ea0a79d3"
},
"downloads": -1,
"filename": "alwayson_py-0.6.0-cp312-cp312-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "cb4fce9e0a963f481f62c61c412990dd",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 492747,
"upload_time": "2025-09-05T04:11:30",
"upload_time_iso_8601": "2025-09-05T04:11:30.208481Z",
"url": "https://files.pythonhosted.org/packages/d1/ec/db2b67e7d3310b2fd8e352ad1869bf3109d0a4fbbbab602d1a3216e993a7/alwayson_py-0.6.0-cp312-cp312-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c43b17b0ce56e9c922a98db247e9c0fb9ec1777bf353d9d4e8502c31686a616a",
"md5": "3d2a963b8ddf6c1e5ea952172cdb099c",
"sha256": "c842eb037def66bf8f4ea2c8ced030d7e156cff0cd5a78e06cbd9abe09532a41"
},
"downloads": -1,
"filename": "alwayson_py-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "3d2a963b8ddf6c1e5ea952172cdb099c",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 562247,
"upload_time": "2025-09-05T04:11:31",
"upload_time_iso_8601": "2025-09-05T04:11:31.832412Z",
"url": "https://files.pythonhosted.org/packages/c4/3b/17b0ce56e9c922a98db247e9c0fb9ec1777bf353d9d4e8502c31686a616a/alwayson_py-0.6.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1c0a90c0f0226b5a2c8f5a001d284feaf74d5f2ea3ea162727514d3aeed2d438",
"md5": "63a538187b8b82b356b38117b14e4b22",
"sha256": "83a745201be99d4c1d4eb328c78996ab2256973029cb6fe19cc7c10b6f276e10"
},
"downloads": -1,
"filename": "alwayson_py-0.6.0-cp312-cp312-manylinux_2_28_aarch64.whl",
"has_sig": false,
"md5_digest": "63a538187b8b82b356b38117b14e4b22",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 556625,
"upload_time": "2025-09-05T04:11:33",
"upload_time_iso_8601": "2025-09-05T04:11:33.170909Z",
"url": "https://files.pythonhosted.org/packages/1c/0a/90c0f0226b5a2c8f5a001d284feaf74d5f2ea3ea162727514d3aeed2d438/alwayson_py-0.6.0-cp312-cp312-manylinux_2_28_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bef411add26d89f88b636354a9dbf10b717fd3d352007bc7acde50f17302294e",
"md5": "f1096fb334a41a1bf6d9c493a472d8a2",
"sha256": "e3dcfe732f82d6838e7c8fb2b841072f0ff26d8c8419a792b3f7965fc06f79c3"
},
"downloads": -1,
"filename": "alwayson_py-0.6.0-cp312-cp312-win_amd64.whl",
"has_sig": false,
"md5_digest": "f1096fb334a41a1bf6d9c493a472d8a2",
"packagetype": "bdist_wheel",
"python_version": "cp312",
"requires_python": ">=3.8",
"size": 372943,
"upload_time": "2025-09-05T04:11:34",
"upload_time_iso_8601": "2025-09-05T04:11:34.681310Z",
"url": "https://files.pythonhosted.org/packages/be/f4/11add26d89f88b636354a9dbf10b717fd3d352007bc7acde50f17302294e/alwayson_py-0.6.0-cp312-cp312-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e9e24d022e1856f5993ae5cb603004cb66b889f2bb720b15c7f664ef7de43d8b",
"md5": "7658919ca1aae5b0019da5955d385f4e",
"sha256": "8565cac9b66d3736bc26ea7a2c045fa7529f435c6bf3a8f7d7f259f3122f4aa5"
},
"downloads": -1,
"filename": "alwayson_py-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "7658919ca1aae5b0019da5955d385f4e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 89776,
"upload_time": "2025-09-05T04:11:37",
"upload_time_iso_8601": "2025-09-05T04:11:37.495204Z",
"url": "https://files.pythonhosted.org/packages/e9/e2/4d022e1856f5993ae5cb603004cb66b889f2bb720b15c7f664ef7de43d8b/alwayson_py-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-05 04:11:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xudesheng",
"github_project": "alwayson_py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "alwayson-py"
}