All Projects → Iotic-Labs → Py Ubjson

Iotic-Labs / Py Ubjson

Licence: apache-2.0
Universal Binary JSON draft-12 serializer for Python

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Py Ubjson

Xmlcoder
Easy XML parsing using Codable protocols in Swift
Stars: ✭ 460 (+1433.33%)
Mutual labels:  decoder, encoder
Jave2
The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project
Stars: ✭ 570 (+1800%)
Mutual labels:  decoder, encoder
IkigaJSON
A high performance JSON library in Swift
Stars: ✭ 316 (+953.33%)
Mutual labels:  encoder, decoder
AnimatedGif
📼 A high performance .NET library for reading and creating animated GIFs
Stars: ✭ 106 (+253.33%)
Mutual labels:  encoder, decoder
Flif
Free Lossless Image Format
Stars: ✭ 3,668 (+12126.67%)
Mutual labels:  decoder, encoder
Encore
Synonym of angkor
Stars: ✭ 19 (-36.67%)
Mutual labels:  decoder, encoder
He
A robust HTML entity encoder/decoder written in JavaScript.
Stars: ✭ 2,973 (+9810%)
Mutual labels:  decoder, encoder
aiff
Battle tested aiff decoder/encoder
Stars: ✭ 20 (-33.33%)
Mutual labels:  encoder, decoder
Tiny Utf8
Unicode (UTF-8) capable std::string
Stars: ✭ 322 (+973.33%)
Mutual labels:  decoder, encoder
Ultrajson
Ultra fast JSON decoder and encoder written in C with Python bindings
Stars: ✭ 3,504 (+11580%)
Mutual labels:  decoder, encoder
schifra
C++ Reed Solomon Error Correcting Library https://www.schifra.com
Stars: ✭ 28 (-6.67%)
Mutual labels:  encoder, decoder
Json Rust
JSON implementation in Rust
Stars: ✭ 395 (+1216.67%)
Mutual labels:  decoder, encoder
morse-pro
Library for manipulating Morse code text and sound. Understands prosigns and Farnsworth speed. Can create WAV files and analyse input from the microphone or audio files.
Stars: ✭ 85 (+183.33%)
Mutual labels:  encoder, decoder
Paseto
Platform-Agnostic Security Tokens implementation in GO (Golang)
Stars: ✭ 461 (+1436.67%)
Mutual labels:  decoder, encoder
android-opus-codec
Implementation of Opus encoder and decoder in C++ for android with JNI
Stars: ✭ 44 (+46.67%)
Mutual labels:  encoder, decoder
Flask Session Cookie Manager
🍪 Flask Session Cookie Decoder/Encoder
Stars: ✭ 257 (+756.67%)
Mutual labels:  decoder, encoder
pytextcodifier
📦 Turn your text files into codified images or your codified images into text files.
Stars: ✭ 14 (-53.33%)
Mutual labels:  encoder, decoder
fadec
A fast and lightweight decoder for x86 and x86-64 and encoder for x86-64.
Stars: ✭ 44 (+46.67%)
Mutual labels:  encoder, decoder
Keras Transformer
Transformer implemented in Keras
Stars: ✭ 273 (+810%)
Mutual labels:  decoder, encoder
Ffmpegcommand
FFmpegCommand适用于Android的FFmpeg命令库,实现了对音视频相关的处理,能够快速的处理音视频,大概功能包括:音视频剪切,音视频转码,音视频解码原始数据,音视频编码,视频转图片或gif,视频添加水印,多画面拼接,音频混音,视频亮度和对比度,音频淡入和淡出效果等
Stars: ✭ 394 (+1213.33%)
Mutual labels:  decoder, encoder

Overview

This is a Python v3.2+ (and 2.7+) Universal Binary JSON encoder/decoder based on the draft-12 specification.

Installing / packaging

# To get from PyPI
pip3 install py-ubjson

# To only build extension modules inline (e.g. in repository)
python3 setup.py build_ext -i

# To build & install globally
python3 setup.py install

# To skip building of extensions when installing (or building)
PYUBJSON_NO_EXTENSION=1 python3 setup.py install

Notes

  • The extension module is not required but provide a significant speed boost.
  • The above can also be run with v2.7+
  • This module is also available via Anaconda (conda-forge)
  • PyPI releases are signed with the Iotic Labs Software release signing key
  • At run time, one can check whether compiled version is in use via the ubjson.EXTENSION_ENABLED boolean

Usage

It's meant to behave very much like Python's built-in JSON module, e.g.:

import ubjson

encoded = ubjson.dumpb({u'a': 1})

decoded = ubjson.loadb(encoded)

Note: Only unicode strings in Python 2 will be encoded as strings, plain str will be encoded as a byte array.

Documentation

import ubsjon
help(ubjson.dump)
help(ubjson.load)

Command-line utility

This converts between JSON and UBJSON formats:

python3 -mubjson
USAGE: ubjson (fromjson|tojson) (INFILE|-) [OUTFILE]

Tests

Static

This library has been checked using flake8 and pylint, using a modified configuration - see pylint.rc and flake8.cfg.

Unit

python3 -mvenv py
. py/bin/activate
pip install -U pip setuptools
pip install -e .[dev]

./coverage_test.sh

Note: See coverage_test.sh for additional requirements.

Limitations

  • The No-Op type is only supported by the decoder. (This should arguably be a protocol-level rather than serialisation-level option.) Specifically, it is only allowed to occur at the start or between elements of a container and only inside un-typed containers. (In a typed container it is impossible to tell the difference between an encoded element and a No-Op.)
  • Strongly-typed containers are only supported by the decoder (apart from for bytes/bytearray) and not for No-Op.
  • Encoder/decoder extensions are not supported at this time.

Why?

The only existing implementation I was aware of at the time of writing (simpleubjson) had the following limitations:

  • Does not support efficient binary encoding
  • Only supports draft-9
  • Only supports individual Python types rather than anything implementing an interface (e.g. Mapping)
  • Does not decode nested arrays or objects in expected form
  • Lacks C extension speed-up
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].