Skip to main content

Language specific uProtocol library for building and using UUri, UUID, UAttributes, UTransport, and more.

Project description

= Eclipse uProtocol Python Library
:toc:

== Overview

This library implements the https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/languages.adoc[uProtocol Language Specific Library Requirements] for Python defined in https://github.com/eclipse-uprotocol/uprotocol-spec/tree/main[uProtocol Specifications]. The library is organized into packages that are described in <<sdk-packages>> below. Each package contains a README.adoc file that describes the purpose of the package and how to use it.

The module contains the factory methods, serializers, and validators for all data types defined in the specifications, and any data models that either haven't or couldn't be defined in uprotocol-core-api yet (ex. UPayload) This library fits into the big picture of the uProtocol SDK as seen in <<uprotocol-sdk>> below.

.uProtocol SDK
image:https://raw.githubusercontent.com/eclipse-uprotocol/uprotocol-spec/main/uprotocol_sdk.drawio.svg[#uprotocol-sdk,width=100%,align="center"]


== Getting Started

=== Prerequisites
Before proceeding with the setup of this project, ensure that the following prerequisites are met:

* Maven is installed and configured in your environment. You can verify this by running the following command in your terminal:
[,bash]
----
mvn -version
----
If Maven is properly installed, you should see information about the Maven version and configuration.

=== Importing the sdk

To set up SDK, follow the steps below:

. Clone the code from the GitHub repository:
+
[source]
----
git clone https://github.com/eclipse-uprotocol/uprotocol-python.git
----

. Execute the `pull_and_compile_protos.py` script using the following command:
+
[source]
----
python pull_and_compile_protos.py
----
This script automates the following tasks:

1. **Cloning and Compilation of Protos:**
Clones the `up-core-api` protos from the specified repository URL, compiles them, and generates Python protofiles in the protos folder.

. Install up-python
+
[source]
----
python -m pip install .
----

*This will install the up-python, making its classes and modules available for import in your python code.*

=== Using The Library

The Library is broken up into different packages that are described in <<sdk-packages>> below. Each package contains a README.adoc file that describes the purpose of the package and how to use it. Packages are organized into the following directories:

.Package Folders
[#pkg-folders,width=100%,cols="20%,80%",options="header"]
|===

| Folder | Purpose

| `*builder*` or `*factory*`
| Contains factory methods for creating uProtocol data types

| `*serializer*`
| Contains serializers to convert the objects into byte or string form representation of said object

| `*validator*`
| Contains validators to validate the data types and report errors if the objects are missing or incorrect

|===


.SDK Packages
[#sdk-packages,width=100%,cols="20%,80%",options="header"]
|===

| Package | Purpose

| link:uprotocol/uri/README.adoc[`*uuri*`]
| Uniform Resource Identifier (RFC3986), how uProtocol addresses things (devices, software, methods, topics, etc...) on the network

| link:uprotocol/uuid/README.adoc[`*uuid*`]
| Identifier used to uniquely identify (and timestamp) messages that are sent

| link:uprotocol/rpc/README.adoc[`*rpc*`]
| Interface to build client and service stubs for uServices. This interface is then implemented by https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l2/rpcclient.adoc[RpcClient interface]

| link:uprotocol/transport/README.adoc[`*utransport*`]
| Interface and data model declaration used for bidirectional point-2-point communication between uEs. This interface is then implemented by https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/ulink.adoc[ulink] libraries for a given underlining transport (ex. Binder, MQTT, Zenoh, SOME/IP, DDS, HTTP, etc…​)

| link:uprotocol/cloudevent/README.adoc[`*cloudevent*`]
| Common way to represent uProtocol messages using CloudEvent data model used by some transports (ex. MQTT, HTTP, etc…​)

|===

NOTE: Please visit the READMEs in <<sdk-packages>> for examples of how to use the different data types and their factories, validators, and serializers.


=== Cleaning Up

Clean up by running the command:
`python clean_project.py`

=== Running the Tests

Requires coverage to be installed first, that can be done by running `pip install coverage`

then you run:
`python -m coverage run --source tests/ -m unittest discover`

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_python-0.1.1.dev0.tar.gz (74.5 kB view details)

Uploaded Source

Built Distribution

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

up_python-0.1.1.dev0-py3-none-any.whl (136.5 kB view details)

Uploaded Python 3

File details

Details for the file up_python-0.1.1.dev0.tar.gz.

File metadata

  • Download URL: up_python-0.1.1.dev0.tar.gz
  • Upload date:
  • Size: 74.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for up_python-0.1.1.dev0.tar.gz
Algorithm Hash digest
SHA256 dd887151563adb3c128281d70bbe16a3eb12c34ff10842c931739d7a248277fb
MD5 bb3b31f559f07e9835e89ea7b6791f2e
BLAKE2b-256 bff4a1d970fea5e4c4e90d8b6c930c0f4b42b1a2885faded20fadde66e7bb537

See more details on using hashes here.

File details

Details for the file up_python-0.1.1.dev0-py3-none-any.whl.

File metadata

  • Download URL: up_python-0.1.1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 136.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for up_python-0.1.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6f7624c4bef267247930ea71da67103d2e7c972d21f3fdb1f4d70f2155a36f
MD5 237c390fbca5759210ae40a0e9193fd5
BLAKE2b-256 89e3d6fb89698fedb081173b500f1aab195f8719ed472720b2caae9b74f222b1

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