Add up_rust_py package with documentation and examples#1
Add up_rust_py package with documentation and examples#1sachinkum0009 wants to merge 14 commits intoeclipse-uprotocol:mainfrom
Conversation
sophokles73
left a comment
There was a problem hiding this comment.
I have provided a few hints and proposals for improvement. My Python knowledge is very limited so I the review of the python code might not be as thorough as you would expect.
I do like the clear structuring and that you already thought about including proper documentation 👍
In general, the Eclipse license header is missing in all files. You may want to take a look a the up-rust repository for the format of the header and where to add it.
pyproject.toml
Outdated
| requires-python = ">=3.8" | ||
| description = "Python bindings for Eclipse uProtocol Rust implementation" | ||
| readme = "README.md" | ||
| license = { text = "Apache-2.0" } |
There was a problem hiding this comment.
From what I see at https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license-and-license-files this should probably be
license = "Apache-2.0"or am I mistaken?
There was a problem hiding this comment.
Thanks, you're right. I will fix it.
| description = "Python bindings for Eclipse uProtocol Rust implementation" | ||
| readme = "README.md" | ||
| license = { text = "Apache-2.0" } | ||
| authors = [ |
There was a problem hiding this comment.
I guess it would also be good to include
license-files = "LICENSE"to refer to the license file in the root folder?
| mqtt = [] # MQTT transport (future) | ||
| someip = [] # SOME/IP automotive protocol (future) |
There was a problem hiding this comment.
IMHO we should omit these until there actually is support for them ...
| discovery = [] # Service discovery (udiscovery feature) | ||
| subscription = [] # Advanced subscription management (usubscription feature) | ||
| twin = [] # Digital twin support (utwin feature) | ||
| cloudevents = [] # CloudEvents format support |
There was a problem hiding this comment.
same here, FMPOV it is totally ok to only start with what is really supported. Once you add more bindings, e.g. for the uSubscription service interface, you can add a corresponding feature extension ..
docs/installation.md
Outdated
|
|
||
| 1. Clone the repository: | ||
| ```bash | ||
| git clone https://github.com/sachinkum0009/up-rust-py.git |
There was a problem hiding this comment.
I guess this should become https://github.com/eclipse-uprotocol/up-rust-py.git, right?
| - Python 3.8 or higher | ||
| - pip (Python package installer) | ||
|
|
||
| ## Install from PyPI |
There was a problem hiding this comment.
IMHO we should add a section recommending to use a virtual environment?
docs/usage.md
Outdated
|
|
||
| Here's a simple example that demonstrates publishing and receiving messages: | ||
|
|
||
| ```python |
There was a problem hiding this comment.
instead of pasting the code in here (where we will have a hard time keeping it in sync with the code base), we should probably simply refer to a file in the examples folder?
| entity ID, and version to create unique identifiers. | ||
| """ | ||
|
|
||
| def __init__(self, authority: str, entity_id: int, version: int) -> None: |
There was a problem hiding this comment.
what happens if I provide a version value that is out of range?
There was a problem hiding this comment.
I found out that the PyO3 automatically converts Python types to Rust Types with validation.
If the value is out of range, it will return a OverflowError.
| Will be called when messages arrive. | ||
|
|
||
| Raises: | ||
| Exception: If registration fails. |
There was a problem hiding this comment.
I am not too familiar with error handling in Python but Exception looks very generic to me. Isn't there a concept for having more specific errors being reported?
To Do
|
Introduce the up_rust_py package, providing Python bindings for uProtocol. Include necessary modules, documentation, and example scripts for usage. This addition enhances the project's functionality and usability.