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
Metadata
Release files for up-py-rs 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| up_py_rs-0.1.2.tar.gz | 66.0 kB | Details |
Built distributions (wheels)
Total release size: 84.4 MB
Release files / up_py_rs-0.1.2.tar.gz
| Download URL | up_py_rs-0.1.2.tar.gz |
|---|---|
| Size | 66.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ad693d7034d045012f14083bbd5b7680cf4910e8c46b001b3a9c0546e9d3eef
|
|
BLAKE2b-256 checksum How to use checksums |
646b97bb4f8c374c8aea0f737a65b7dc87689e8f958efbb2371e4a2163f37993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.7 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.10 PyPy 3.10 7.3 |
|
SHA-256 checksum How to use checksums |
611fd7007f56548b35a81d24f83b2a9653265acbc78e0a708d5716d1ca1d989a
|
|
BLAKE2b-256 checksum How to use checksums |
fd161d16970291ad657524a4d7abb0ff75da2ea9f4365965e7f5f73752efac9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | up_py_rs-0.1.2-pp310-pypy310_pp73-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 9.4 MB |
| Tags | Linux glibc 2.17+ x86-32 PyPy 3.10 PyPy 3.10 7.3 |
|
SHA-256 checksum How to use checksums |
4f25381739fc7ac5107c9486f6d2f3bb0e631ba936eb049ed0daead452895f71
|
|
BLAKE2b-256 checksum How to use checksums |
92b7d4ee466da91147d039cf4a481169ee5340d27a973e88f34461505c0c1b35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.7 MB |
| Tags | Linux glibc 2.17+ x86-64 PyPy 3.9 PyPy 3.9 7.3 |
|
SHA-256 checksum How to use checksums |
737c52d2b3565548c6fc9738707cf2a045c74f4b3dc8c00bd944ed9814b78576
|
|
BLAKE2b-256 checksum How to use checksums |
048b02f099af4278392099c3c71510bd3b2fb5b7fbbcdb23c741eb442fa79ee1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | up_py_rs-0.1.2-pp39-pypy39_pp73-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 9.4 MB |
| Tags | Linux glibc 2.17+ x86-32 PyPy 3.9 PyPy 3.9 7.3 |
|
SHA-256 checksum How to use checksums |
ce5639f7339887384687663816ade1f3e7344e85308a480ed923ffcd375b444c
|
|
BLAKE2b-256 checksum How to use checksums |
98e114640df679fb53a4db81644a463e842fe5dd846871a2b8b6df70df6ada09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-cp38-abi3-win_amd64.whl
| Download URL | up_py_rs-0.1.2-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 7.2 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
bb1ff3ba3e501ccbaf87eb17dae4f6b44d161705be8df4d674b77c8ad2cd932b
|
|
BLAKE2b-256 checksum How to use checksums |
222e3735c128f06cbe5cc0adb37fd85396778d8d64d581b531b4f49c759b9875
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-cp38-abi3-win32.whl
| Download URL | up_py_rs-0.1.2-cp38-abi3-win32.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.8 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
cac2407b441d7f6d4d581c29a7f43fa61f84cb70a57378590b09da1f280a7cb1
|
|
BLAKE2b-256 checksum How to use checksums |
cef4d1941a0b3d87e706263c42e4eca0a4a1ed9730158a763fdbfc898941ca0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 8.7 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f4758ba56bbf7737eef84b5a78ee99862bf8dbd9ba30d5a42220e8755dcce9e9
|
|
BLAKE2b-256 checksum How to use checksums |
12edc530659aa23656d55328f2bfab365f588d0bd9aae2f4abbbe25a46064aed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | up_py_rs-0.1.2-cp38-abi3-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 9.4 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
66d05765784c6edd5116c37160ea14a2b54b52583823a04ce44925bf67fc4832
|
|
BLAKE2b-256 checksum How to use checksums |
61ff1891359fc1fa26f7d5c1d12046914c54dc587ee084bb9865de1aca549789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | up_py_rs-0.1.2-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 8.0 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
420942e1ed5af5c9633f26297c2a16a2afd29a126affe8267ae424943290e698
|
|
BLAKE2b-256 checksum How to use checksums |
0fa7d154d27dae04c1344160039f3269f4fe3c0baeec0f4c3153a00ef5f51672
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|
Release files / up_py_rs-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | up_py_rs-0.1.2-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 8.2 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
0066a017deab06b34cbc20492cfc39fab5d594fb5c74bfc1c9367d25b0a4f332
|
|
BLAKE2b-256 checksum How to use checksums |
90336c8fe6d79bd7bb210cfd6a04829720c4c3bf310006c14b4980a8a1f92c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.11.5
|