Skip to content
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

[feature request] msgpack and msgpackz loaders #2419

Open
maxim-uvarov opened this issue Jun 9, 2024 · 4 comments
Open

[feature request] msgpack and msgpackz loaders #2419

maxim-uvarov opened this issue Jun 9, 2024 · 4 comments
Labels

Comments

@maxim-uvarov
Copy link
Contributor

Saul, Anja, could you please add support for the msgpack and msgpackz formats?
I would love to replace JSON (which works fine anyway) with msgpack for communication between nushell and visidata.
I tried to rewrite the current JSON loader for msgpack with the help of GPT, but my attempts failed. So I'm asking you, as it doesn't seem like a very difficult task. 🙏🙏🙏

@saulpw
Copy link
Owner

saulpw commented Jun 9, 2024

@maxim-uvarov Can you provide a short Python script that uses an existing Python import (perhaps from PyPI) to parse msgpack into a Python dict/array? And a sample file to test it with.

@maxim-uvarov
Copy link
Contributor Author

Saul, here are you are: msgpack-files.zip 🙏

Also, could you please help with allowing the opening of those binary formats received from stdin?

files in archive:

msgpackz_loader1.py
msgpack_loader1.py
1.msgpackz
1.msgpack
> python3 msgpack_loader1.py
[{'name': '1.msgpack', 'type': 'file', 'size': 249, 'modified': Timestamp(seconds=1717917699, nanoseconds=885072844)}, {'name': '1.msgpackz', 'type': 'file', 'size': 5981, 'modified': Timestamp(seconds=1717328654, nanoseconds=6337105)}]
> python3 msgpackz_loader1.py
[{'name': '1.msgpack', 'type': 'file', 'size': 247, 'modified': Timestamp(seconds=1717917709, nanoseconds=189066405)}, {'name': '1.msgpack.zip', 'type': 'file', 'size': 275, 'modified': Timestamp(seconds=1717917832, nanoseconds=368912550)}, {'name': '1.msgpackz', 'type': 'file', 'size': 5981, 'modified': Timestamp(seconds=1717328654, nanoseconds=6337105)}, {'name': 'msgpack_loader1.py', 'type': 'file', 'size': 332, 'modified': Timestamp(seconds=1717917728, nanoseconds=220876256)}, {'name': 'msgpack_test.py', 'type': 'file', 'size': 1795, 'modified': Timestamp(seconds=1717562304, nanoseconds=101682224)}]

saulpw added a commit that referenced this issue Jun 9, 2024
@saulpw
Copy link
Owner

saulpw commented Jun 9, 2024

The loader was trivial; see the referenced PR. GPT is useless for this apparently.

We can merge it once the PR is updated to address all the items in the loader checklist. If you're up to the task, @maxim-uvarov, it would be much appreciated.

@maxim-uvarov
Copy link
Contributor Author

Thank you so much @saulpw!!! Yep, I will try to work on the PR to finish it properly

anjakefala added a commit to maxim-uvarov/visidata that referenced this issue Jun 28, 2024
Co-authored-by: maxim-uvarov
Co-authored-by: anjakefala <[email protected]>
anjakefala added a commit to maxim-uvarov/visidata that referenced this issue Jun 28, 2024
Co-authored-by: maxim-uvarov <[email protected]>
Co-authored-by: anjakefala <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants