New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for MessagePack #4241
Comments
mpack library is good for embedding to micropython. |
how to use? |
Don't know about mpack, but the pure Python implementation of the 'official' MessagePack Python implementation (i.e. what you get when installing via pip or conda, all .py files from https://github.com/msgpack/msgpack-python/tree/master/msgpack) almost works out of the box for basic usecases. The only problem is it uses multiple inheritance for it's exceptions, which MicroPython doesn't support, but is fairly easy to fix: modify 2 lines and make |
Well, the "official" msgpack implementation is inefficient as heck. Encoding a single three-element dict takes ~1k memory. Owch. I'm working on simplifying and rewriting it so that it uses (small) buffers, instead of copying data all over the place. Will be part of my microfuse project (https://github.com/M-o-a-T/microfuse) shortly. |
Which implementation, one of the Python implementations? Or the C one? |
404 |
Python. I haven't looked at details of the C implementation because I have no free week to write a MicroPython interface for it. Mostly-fixing the Python code is childs play by comparison.
The original mail had a typo (github.om). Since fixed, please try again. |
Assuming you mean the one linked above, did you also check https://github.com/vsergeev/u-msgpack-python ? |
I just looked at it. Same inefficiency problems. Worse, the author doesn't even seem to know that you can write
. Even worse it doesn't support unpacking a stream of messages, which is a required exercise with One use case is OTA updates. If you can't even send a 4k bytestring to or from the device without running into intermittent errors, even though On the plus side my rewrite is almost done and all I need to do is test (and document …) it. On the minus side there's a memory error in MicroPython somewhere in the bytearray slicing/assignment code. I haven't been able to reproduce it yet, but I frequently get this:
|
Still 404
What is
Is this the same as #7261 and if so did you try with a version which includes the fix for that? Otherwise please create an issue with code to reproduce this. |
I have no idea which link you're trying, but https://github.com/M-o-a-T/microfuse works perfectly for me.
Some check whether you're running on python2 or python3. Sorry, I thought that'd be obvious.
Unfortunately not. I will as soon as I can actually reproduce the thing. |
Test in a private browser window or when not logged in into github, it has probably non-public accessibility.
That part is obvious, what is not obvious is where you get it from, and/or what you really mean with your rant :) But it's off-topic anyway. |
See this new library by @peterhinch : https://github.com/peterhinch/micropython-msgpack |
Hello,
Related #4200
Supporting an other binary serializer/deserializer such as MessagePack could be a nice feature also.
I noticed
https://github.com/msgpack/msgpack-python
and https://github.com/vsergeev/u-msgpack-python
but I'm not sure if it's currently available for micropython.
Is there unit tests framework such as pytest on micropython because u-msgpack-python uses it? ...
Not sure pytest is available on micropython according construct/construct#224 (comment)
Kind regards
The text was updated successfully, but these errors were encountered: