Skip to main content

Python bindings for Eclipse uProtocol Rust implementation

Project description

up-py-rs

CI Status PyPI version Python 3.8+ License

Python bindings for the Eclipse uProtocol Rust implementation (up-rust). This package provides high-performance Python APIs for uProtocol communication patterns by leveraging Rust's speed and safety.

Features

  • 🚀 High Performance: Rust-powered implementations with minimal Python overhead
  • 🔒 Type Safe: Full type hints and stub files for excellent IDE support
  • 📡 Complete uProtocol Support: Publishers, Notifiers, and Transport implementations
  • 🐍 Pythonic API: Easy-to-use interfaces that feel natural in Python
  • Async Ready: Built on Tokio async runtime for efficient I/O operations

Installation

Install from PyPI:

pip install up-py-rs

Or using uv:

uv add up-py-rs

Quick Start

Simple Publisher

from up_py_rs import StaticUriProvider
from up_py_rs.local_transport import LocalTransport
from up_py_rs.communication import SimplePublisher, UPayload

# Setup
uri_provider = StaticUriProvider("my-vehicle", 0xa34b, 0x01)
transport = LocalTransport()
publisher = SimplePublisher(transport, uri_provider)

# Publish a message
payload = UPayload.from_string("Hello from Python!")
publisher.publish(0xb4c1, payload)

Simple Notifier

from up_py_rs import StaticUriProvider
from up_py_rs.local_transport import LocalTransport
from up_py_rs.communication import SimpleNotifier, UPayload

def notification_handler(msg):
    text = msg.extract_string()
    if text:
        print(f"Received: {text}")

# Setup
uri_provider = StaticUriProvider("my-vehicle", 0xa34b, 0x01)
transport = LocalTransport()
notifier = SimpleNotifier(transport, uri_provider)

# Register listener
topic = uri_provider.get_resource_uri(0xd100)
notifier.start_listening(topic, notification_handler)

# Send notification
payload = UPayload.from_string("Alert!")
destination = uri_provider.get_source_uri()
notifier.notify(0xd100, destination, payload)

# Cleanup
notifier.stop_listening(topic, notification_handler)

Components

LocalTransport

In-process message transport for testing and local communication without network overhead.

StaticUriProvider

Creates and manages uProtocol URIs for identifying entities in the network.

SimplePublisher

High-level API for publishing messages to specific resources.

SimpleNotifier

Send and receive notifications between uEntities with listener callbacks.

UPayload

Message payload wrapper supporting strings and raw bytes with protobuf format.

Development

Building from Source

Requirements:

  • Python 3.8+
  • Rust toolchain (for building)
  • uv or pip
# Clone the repository
git clone https://github.com/sachinkum0009/up-py-rs.git
cd up-py-rs

# Build in development mode
uv run maturin develop

# Run tests
uv run pytest

# Run examples
uv run python examples/simple_publish.py
uv run python examples/simple_notify.py

Building Wheels

# Build release wheel
uv run maturin build --release

# Build and publish to PyPI
uv run maturin publish

Architecture

up-py-rs bridges Python and Rust using PyO3:

  • Rust Core: High-performance implementations from up-rust
  • PyO3 Bindings: Zero-cost abstractions between Python and Rust
  • Python API: Pythonic interfaces with full type hints

Each async operation maintains its own Tokio runtime for thread-safe execution across the Python/Rust boundary.

Contributing

Contributions are welcome! Please see the contribution guidelines for details.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Links

Acknowledgments

Built with:

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

up_py_rs-0.0.7.tar.gz (39.9 kB view details)

Uploaded Source

Built Distributions

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

up_py_rs-0.0.7-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

up_py_rs-0.0.7-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ i686

up_py_rs-0.0.7-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ x86-64

up_py_rs-0.0.7-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded PyPymanylinux: glibc 2.17+ i686

up_py_rs-0.0.7-cp38-abi3-win_amd64.whl (1.0 MB view details)

Uploaded CPython 3.8+Windows x86-64

up_py_rs-0.0.7-cp38-abi3-win32.whl (949.2 kB view details)

Uploaded CPython 3.8+Windows x86

up_py_rs-0.0.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

up_py_rs-0.0.7-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl (1.6 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ i686

up_py_rs-0.0.7-cp38-abi3-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

up_py_rs-0.0.7-cp38-abi3-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file up_py_rs-0.0.7.tar.gz.

File metadata

  • Download URL: up_py_rs-0.0.7.tar.gz
  • Upload date:
  • Size: 39.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for up_py_rs-0.0.7.tar.gz
Algorithm Hash digest
SHA256 f23045f4458c277e09ff6845588cb7997e1a3cf5ec0d7474207ca9555f95f628
MD5 ef5f69ff546ea63e179798cf1ebfaa43
BLAKE2b-256 3f54954a0e444ae049c294a36967b3d4c2018a0996bd083fcdb105b2abaa9074

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 96bc3ce40266cbace69f7b1543466165b2c64d5e0ba876db4bfd4bf62a69898c
MD5 095da71a47101318072a09e6455dbc7f
BLAKE2b-256 b588953896c578832c41d013574d6d48f763114c50de36f55b50c28e920bfea5

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 4decab5dd67f7e816ee253c8e8f996c4f7ae64313695d5387ad4eeb02ed3d380
MD5 888e9ba89c881ebf5512a4bbc775106f
BLAKE2b-256 09d8fd81c5aaeb7262c51ab9ab2dd6063e9673cbf46c6a4c84d4547bfece5e72

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7509c22dbe796fef10869dc48ff183f381d061553017192c822d71016ba1663
MD5 24575ccab9eced16443fbc154ea68895
BLAKE2b-256 8eb2b0575010d8a432ae9d956689de8e7ae729026376dc429d9ebab43bd86d7c

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6ae1af5aeb82e601d540fdcb1e3f3fd42e142fe63cb76774ced5fc77f990356d
MD5 b409c424c2c16b9e7d489d16beba74a6
BLAKE2b-256 1edde5b6740ec113f24e116a0cdfec4878758c7fca760b7c379f6d36608d1686

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: up_py_rs-0.0.7-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for up_py_rs-0.0.7-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 78c5427adf6195eb30e6d776ca16ddf94f7d196919d3ffcedeeb896fc807c938
MD5 f0a00cbd7a840773338b0f027bd892ad
BLAKE2b-256 adec535175660d7391dd3c1c7add3850419db2e0aad098406c5bc5ab04db6941

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-cp38-abi3-win32.whl.

File metadata

  • Download URL: up_py_rs-0.0.7-cp38-abi3-win32.whl
  • Upload date:
  • Size: 949.2 kB
  • Tags: CPython 3.8+, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for up_py_rs-0.0.7-cp38-abi3-win32.whl
Algorithm Hash digest
SHA256 8b8b5db8cc11ed713b2db34f82a974b3201eff5319d0bb9e3f91e8bea12b081f
MD5 fae0bee1010ac4d4e87167e504978986
BLAKE2b-256 02b792759e8be4a149da468b3211a006c327bd7fee1bda07ecfca843975bcc27

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a340863cca5a34fdb7d8a8fea3d8e8e9cf47447dcd78ae7fe666e02c827b8193
MD5 12f857d43738a37e32fee9ea4b1e8bc1
BLAKE2b-256 4258eff6985f62ba2b2c2895e5fc3061103bd6b3c5d0023fd8a46687d446d065

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 7a414caa6e936f60a95a2ea06b23089bea2e76a724dfe1d76aeea1b6e72391ea
MD5 512c290ddbbdfbbdefde5c64c34b68de
BLAKE2b-256 4ee8c1b501778e8f3132bb3ebf6fe273bd48e664beb07647ee30aaad2c68bc60

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f6c3ff8acf25d6d458c0c0c10181ff2b4a191dd3b9e2172ad00c18b215d1fd33
MD5 c0d81c40cc2603c7d9f4d35abb008663
BLAKE2b-256 797dec00c8a5c20e09d907fffdaa7fc8cf01608793acbcb0b374de1c3222712d

See more details on using hashes here.

File details

Details for the file up_py_rs-0.0.7-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for up_py_rs-0.0.7-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7c4cc5989f1dd61a980e90f7efbd582fa7d2bd4b41fe037f5ed94380ceb7a7e9
MD5 93bd6bf7f31b8c673b56dba36c478021
BLAKE2b-256 012b1966cb64691237933f0aea9a28eb7cfab65b66da26ae4332bcf2b319e40b

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