Python bindings for Eclipse uProtocol Rust implementation
Project description
up-py-rs
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:
# Basic installation (includes LocalTransport and core features)
pip install up-py-rs
# Build from source with specific transports:
pip install up-py-rs[zenoh] # Note: Requires build tools (see below)
pip install up-py-rs[all] # All features
Important: The PyPI wheel includes only the base features. For transport protocols like Zenoh, you need to either:
-
Build from source (recommended for transport features):
pip install maturin pip install up-py-rs --no-binary up-py-rs --config-settings="--features=zenoh"
-
Install the pre-built complete wheel (if available for your platform):
pip install up-py-rs-complete # Includes all transports
-
Use a Docker image with pre-built binaries (coming soon)
Or using uv:
uv add up-py-rs
# Build with features
uv pip install up-py-rs --no-binary up-py-rs
Optional Dependencies
up-py-rs supports modular installation through build-time features:
| Feature | Description | Build Command |
|---|---|---|
zenoh |
Zenoh network transport | pip install --no-binary up-py-rs --config-settings="--features=zenoh" |
mqtt |
MQTT transport (coming soon) | TBD |
all-transports |
All transport protocols | --features=all-transports |
discovery |
Service discovery | Included in base |
subscription |
Subscription management | Included in base |
twin |
Digital twin support | Included in base |
cloudevents |
CloudEvents format | Included in base |
all |
Everything | --features=all |
Development Installation (includes all features):
git clone https://github.com/sachinkum0009/up-py-rs.git
cd up-py-rs
pip install maturin
maturin develop --features all-transports
Quick Start
Simple Publisher (Local Transport)
For in-process communication without network overhead:
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)
Zenoh Publisher (Network Transport)
For distributed communication across network boundaries:
from up_py_rs import StaticUriProvider
from up_py_rs.zenoh_transport import UPTransportZenoh
from up_py_rs.communication import SimplePublisher, UPayload
# Setup Zenoh transport
uri_provider = StaticUriProvider("publisher", 0x3b1da, 1)
transport = UPTransportZenoh.builder("publisher").build()
publisher = SimplePublisher(transport, uri_provider)
# Publish messages
for i in range(1, 11):
payload = UPayload.from_string(f"event {i}")
publisher.publish(0x8001, payload)
Note: Requires pip install up-py-rs[zenoh]
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. Best for single-process applications and testing.
UPTransportZenoh
Zenoh-based network transport for distributed communication across network boundaries. Enables pub/sub patterns between different processes, devices, or vehicles. Requires zenoh extra.
StaticUriProvider
Creates and manages uProtocol URIs for identifying entities in the network.
SimplePublisher
High-level API for publishing messages to specific resources. Works with any transport (Local or Zenoh).
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
# Run Zenoh examples (requires zenoh extra)
uv add up-py-rs --extra zenoh
# Terminal 1: Start subscriber
uv run python examples/simple_zenoh_subscriber.py
# Terminal 2: Start publisher
uv run python examples/simple_zenoh_publisher.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:
- Eclipse uProtocol - The underlying protocol specification
- PyO3 - Rust bindings for Python
- Maturin - Build tool for Rust/Python projects
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file up_py_rs-0.1.2.tar.gz.
File metadata
- Download URL: up_py_rs-0.1.2.tar.gz
- Upload date:
- Size: 66.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ad693d7034d045012f14083bbd5b7680cf4910e8c46b001b3a9c0546e9d3eef
|
|
| MD5 |
c5268ab75fdf3363f8470368fda33d43
|
|
| BLAKE2b-256 |
646b97bb4f8c374c8aea0f737a65b7dc87689e8f958efbb2371e4a2163f37993
|
File details
Details for the file up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.7 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
611fd7007f56548b35a81d24f83b2a9653265acbc78e0a708d5716d1ca1d989a
|
|
| MD5 |
a6766f52d73704936839f21aa49bd6b3
|
|
| BLAKE2b-256 |
fd161d16970291ad657524a4d7abb0ff75da2ea9f4365965e7f5f73752efac9a
|
File details
Details for the file up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 9.4 MB
- Tags: PyPy, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f25381739fc7ac5107c9486f6d2f3bb0e631ba936eb049ed0daead452895f71
|
|
| MD5 |
cadfbdbca24757d7ef7add534ff69972
|
|
| BLAKE2b-256 |
92b7d4ee466da91147d039cf4a481169ee5340d27a973e88f34461505c0c1b35
|
File details
Details for the file up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.7 MB
- Tags: PyPy, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
737c52d2b3565548c6fc9738707cf2a045c74f4b3dc8c00bd944ed9814b78576
|
|
| MD5 |
34d148cdd190675e8d8e1b8271f4487c
|
|
| BLAKE2b-256 |
048b02f099af4278392099c3c71510bd3b2fb5b7fbbcdb23c741eb442fa79ee1
|
File details
Details for the file up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 9.4 MB
- Tags: PyPy, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce5639f7339887384687663816ade1f3e7344e85308a480ed923ffcd375b444c
|
|
| MD5 |
0a940d01b6c411ef894c3174c397e540
|
|
| BLAKE2b-256 |
98e114640df679fb53a4db81644a463e842fe5dd846871a2b8b6df70df6ada09
|
File details
Details for the file up_py_rs-0.1.2-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: up_py_rs-0.1.2-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 7.2 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb1ff3ba3e501ccbaf87eb17dae4f6b44d161705be8df4d674b77c8ad2cd932b
|
|
| MD5 |
782eb89785d917c8160cec209a3403d8
|
|
| BLAKE2b-256 |
222e3735c128f06cbe5cc0adb37fd85396778d8d64d581b531b4f49c759b9875
|
File details
Details for the file up_py_rs-0.1.2-cp38-abi3-win32.whl.
File metadata
- Download URL: up_py_rs-0.1.2-cp38-abi3-win32.whl
- Upload date:
- Size: 6.4 MB
- Tags: CPython 3.8+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cac2407b441d7f6d4d581c29a7f43fa61f84cb70a57378590b09da1f280a7cb1
|
|
| MD5 |
3563fa699da1cd139f7adea4aa040209
|
|
| BLAKE2b-256 |
cef4d1941a0b3d87e706263c42e4eca0a4a1ed9730158a763fdbfc898941ca0b
|
File details
Details for the file up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.7 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4758ba56bbf7737eef84b5a78ee99862bf8dbd9ba30d5a42220e8755dcce9e9
|
|
| MD5 |
b94cd87f390aa419fec3970db40d32d4
|
|
| BLAKE2b-256 |
12edc530659aa23656d55328f2bfab365f588d0bd9aae2f4abbbe25a46064aed
|
File details
Details for the file up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl.
File metadata
- Download URL: up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
- Upload date:
- Size: 9.4 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66d05765784c6edd5116c37160ea14a2b54b52583823a04ce44925bf67fc4832
|
|
| MD5 |
cd619fe7814026e324c21f922fd6c23f
|
|
| BLAKE2b-256 |
61ff1891359fc1fa26f7d5c1d12046914c54dc587ee084bb9865de1aca549789
|
File details
Details for the file up_py_rs-0.1.2-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: up_py_rs-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.0 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
420942e1ed5af5c9633f26297c2a16a2afd29a126affe8267ae424943290e698
|
|
| MD5 |
1f52ba167440b3f693163d50cbe94e12
|
|
| BLAKE2b-256 |
0fa7d154d27dae04c1344160039f3269f4fe3c0baeec0f4c3153a00ef5f51672
|
File details
Details for the file up_py_rs-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: up_py_rs-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 8.2 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0066a017deab06b34cbc20492cfc39fab5d594fb5c74bfc1c9367d25b0a4f332
|
|
| MD5 |
52b346c2f4566f4d811329723c234ce8
|
|
| BLAKE2b-256 |
90336c8fe6d79bd7bb210cfd6a04829720c4c3bf310006c14b4980a8a1f92c7b
|