Skip to main content

YpyJson

Yet Another Python Json Library

A Fast Json Reader made in Cython for handling fast json parsing using the yyjson library.

Some of it's techniques are simillar to simdjson but with a few fast conversion methods to convert objects to python objects.

Ypyjson can trade safety for speed since yyjson is faster than simdjson

from ypyjson import YpyObject

y = YpyObject(b'{"Eggs":"spam","Foo":["bar","baz"]}', 0)
bar = y.get_pointer("/Foo/0")
print(f"result :{bar!r}")
# result: 'bar'
print(y["Eggs"])
# spam

Ypy also has flags for reading json files as well

from ypyjson import loads, YpyReadFlag


y = loads(b'{"ypy":"json","data":{"text":[1,2,3,4]}}', YpyReadFlag.ALLOW_COMMENTS | YpyReadFlag.READ_NUMBER_AS_RAW)


text = y.get_pointer("/data/text")

print(text)
for t in text:
    print(t)

# <ypyjson.reader.YpyArray object at 0x00000256F6DD1D30>
# b'1'
# b'2'
# b'3'
# b'4'

Ypyjson has Cython compatability and is really made for Cython as well for expandable performance benefits elsewhere...

from ypyjson.reader cimport cloads, YpyObject , YpyArray 
#etc...

Note that for the read flags, you'll need to refer to the Variable Documentation linked below in yyjson's documentation

https://ibireme.github.io/yyjson/doc/doxygen/html/yyjson_8h.html#aff1d62b68993630e74355e4611b77520

Luckily , ypyjson.reader.pxd has them already inplace so you'll just have to do the following to access those variables...

#cython: langauge_level = 3
from ypyjson.reader cimport (
    cloads, 
    YpyObject , 
    YpyArray , 
    YYJSON_READ_ALLOW_COMMENTS,
    YYJSON_READ_ALLOW_INF_AND_NAN,
    YYJSON_READ_ALLOW_INVALID_UNICODE
    #etc...
)

Installation

For now it is still being worked on and figured out but I'm almost done so don't worry about it yet... :)

TODOs

  • Implement a reader and extract all variables directly to python...

  • [] Create Benchmarks with SimdJson's python library to figure what could be needed to improve this library's performance...

  • [] Make sure that after launching to pypi library for this code that YpyJson can work directly with Cython via cimport , Might have to look into numpy for ideas on it's implementation...

  • [] Maybe look into Adding YpyJson as a Header File for CPython Usage....

  • [] Make a YpyVariable cdef class Object in Cython (Cython only...) to improve upon speed until the Object needs or is ready to be identified in either C or Python...

  • [] In a future update, implement a mutable writer (The Current one made is broken and is having issues...)

  • [] When yyjson comes out with a Streaming API , add streaming API Under a DynamicLoader class varaible

  • [] Once Beta Version of this python library is avalibe and inplace via pypi Make sure that yyjson.c as well as yyjson.h is included for compiling to Cython.

  • including/bundling cython package with pypi when I've figure it out...

Metadata

Release files for ypyjson 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ypyjson 0.0.2
File Size Uploaded Provenance Actions
ypyjson-0.0.2.tar.gz 160.9 kB Without provenance Details for ypyjson-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ypyjson 0.0.2
File Interpreter ABI Platform Actions
ypyjson-0.0.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details for ypyjson-0.0.2-cp39-cp39-win_amd64.whl

Total release size: 387.1 kB

Release files / ypyjson-0.0.2.tar.gz

Download URL ypyjson-0.0.2.tar.gz
Size 160.9 kB
Tags Source
SHA-256 checksum
How to use checksums
656a70b10f91c9b79017f74029dde989ae71866e28ad9a7c77dd90744fb0cfdd
BLAKE2b-256 checksum
How to use checksums
5ef90434ce5147eced6d3a6038fcd8039ff44f6eb5aee2cbf732b354c736e90b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.9.13

Release files / ypyjson-0.0.2-cp39-cp39-win_amd64.whl

Download URL ypyjson-0.0.2-cp39-cp39-win_amd64.whl
Size 226.2 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
7468de90b03cc67f9a65655d46848d1b19ca2a7de10ccad578c50044c1690d9d
BLAKE2b-256 checksum
How to use checksums
9bdc6485d4774e07b87cf1d7e60daa2dd97de35667c09f2333b40463f322d9da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.0.1 pkginfo/1.7.1 requests/2.28.2 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.9.13

Security for ypyjson 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page