This library implements the uProtocol Language Specific Library Requirements for Python defined in 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.
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:
mvn -version
If Maven is properly installed, you should see information about the Maven version and configuration.
To set up SDK, follow the steps below:
-
Clone the code from the GitHub repository:
git clone https://github.com/eclipse-uprotocol/uprotocol-python.git
-
Execute the
pull_and_compile_protos.py
script using the following commands:cd scripts python pull_and_compile_protos.py
This script automates the following tasks:
-
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
python -m pip install ../
This will install the up-python, making its classes and modules available for import in your python code.
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:
Folder | Purpose |
---|---|
|
Contains factory methods for creating uProtocol data types |
|
Contains serializers to convert the objects into byte or string form representation of said object |
|
Contains validators to validate the data types and report errors if the objects are missing or incorrect |
Package | Purpose |
---|---|
Uniform Resource Identifier (RFC3986), how uProtocol addresses things (devices, software, methods, topics, etc…) on the network |
|
Identifier used to uniquely identify (and timestamp) messages that are sent |
|
Interface to build client and service stubs for uServices. This interface is then implemented by RpcClient interface |
|
Interface and data model declaration used for bidirectional point-2-point communication between uEs. This interface is then implemented by ulink libraries for a given underlining transport (ex. Binder, MQTT, Zenoh, SOME/IP, DDS, HTTP, etc…) |
|
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. |