ypyjson


Nameypyjson JSON
Version 0.0.2 PyPI version JSON
download
home_page
Summaryyet another python json library using yyjson
upload_time2023-05-15 22:12:31
maintainer
docs_urlNone
authorVizonex
requires_python
licenseUnlicense
keywords yyjson ypyjson json cython
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```python
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

```python
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...

```cython 
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 
#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
- [x] 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.
 
- [x] including/bundling cython package with pypi when I've figure it out...

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ypyjson",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "yyjson,ypyjson,json,cython",
    "author": "Vizonex",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/5e/f9/0434ce5147eced6d3a6038fcd8039ff44f6eb5aee2cbf732b354c736e90b/ypyjson-0.0.2.tar.gz",
    "platform": null,
    "description": "# YpyJson\n\nYet Another Python Json Library \n\nA Fast Json Reader made in Cython for handling fast json parsing \nusing the yyjson library. \n\nSome of it's techniques are simillar to simdjson but with a few\nfast conversion methods to convert objects to python objects. \n\nYpyjson can trade safety for speed since yyjson is faster than simdjson\n\n```python\nfrom ypyjson import YpyObject\n\ny = YpyObject(b'{\"Eggs\":\"spam\",\"Foo\":[\"bar\",\"baz\"]}', 0)\nbar = y.get_pointer(\"/Foo/0\")\nprint(f\"result :{bar!r}\")\n# result: 'bar'\nprint(y[\"Eggs\"])\n# spam\n```\n\nYpy also has flags for reading json files as well\n\n```python\nfrom ypyjson import loads, YpyReadFlag\n\n\ny = loads(b'{\"ypy\":\"json\",\"data\":{\"text\":[1,2,3,4]}}', YpyReadFlag.ALLOW_COMMENTS | YpyReadFlag.READ_NUMBER_AS_RAW)\n\n\ntext = y.get_pointer(\"/data/text\")\n\nprint(text)\nfor t in text:\n    print(t)\n\n# <ypyjson.reader.YpyArray object at 0x00000256F6DD1D30>\n# b'1'\n# b'2'\n# b'3'\n# b'4'\n\n```\n\nYpyjson has Cython compatability and is really made for Cython as well for expandable performance benefits elsewhere...\n\n```cython \nfrom ypyjson.reader cimport cloads, YpyObject , YpyArray \n#etc...\n```\nNote that for the read flags, you'll need to refer to the Variable Documentation linked below in yyjson's documentation \n\nhttps://ibireme.github.io/yyjson/doc/doxygen/html/yyjson_8h.html#aff1d62b68993630e74355e4611b77520\n\nLuckily , `ypyjson.reader.pxd` has them already inplace \nso you'll just have to do the following\nto access those variables...\n\n```cython \n#cython: langauge_level = 3\nfrom ypyjson.reader cimport (\n    cloads, \n    YpyObject , \n    YpyArray , \n    YYJSON_READ_ALLOW_COMMENTS,\n    YYJSON_READ_ALLOW_INF_AND_NAN,\n    YYJSON_READ_ALLOW_INVALID_UNICODE\n    #etc...\n)\n\n```\n## Installation\nFor now it is still being worked on and figured out but I'm almost done so don't worry about it yet... :) \n\n## TODOs\n- [x] Implement a reader and extract all variables directly to python...\n\n- [] Create Benchmarks with SimdJson's python library to figure what could be needed to improve this library's performance...\n\n- [] Make sure that after launching to pypi\nlibrary for this code that YpyJson can work directly with Cython via cimport , Might have to look into numpy for ideas on it's implementation...\n\n- [] Maybe look into Adding YpyJson as a Header File for CPython Usage....\n\n- [] 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...\n\n- [] In a future update, implement a mutable writer (The Current one made is broken and is having issues...)\n\n- [] When yyjson comes out with a Streaming API , add streaming API Under a DynamicLoader class varaible\n\n- [] 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.\n \n- [x] including/bundling cython package with pypi when I've figure it out...\n",
    "bugtrack_url": null,
    "license": "Unlicense",
    "summary": "yet another python json library using yyjson",
    "version": "0.0.2",
    "project_urls": null,
    "split_keywords": [
        "yyjson",
        "ypyjson",
        "json",
        "cython"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9bdc6485d4774e07b87cf1d7e60daa2dd97de35667c09f2333b40463f322d9da",
                "md5": "0d7cd13eaf10e6f80445a164d373b7f3",
                "sha256": "7468de90b03cc67f9a65655d46848d1b19ca2a7de10ccad578c50044c1690d9d"
            },
            "downloads": -1,
            "filename": "ypyjson-0.0.2-cp39-cp39-win_amd64.whl",
            "has_sig": false,
            "md5_digest": "0d7cd13eaf10e6f80445a164d373b7f3",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": null,
            "size": 226218,
            "upload_time": "2023-05-15T22:12:29",
            "upload_time_iso_8601": "2023-05-15T22:12:29.870057Z",
            "url": "https://files.pythonhosted.org/packages/9b/dc/6485d4774e07b87cf1d7e60daa2dd97de35667c09f2333b40463f322d9da/ypyjson-0.0.2-cp39-cp39-win_amd64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ef90434ce5147eced6d3a6038fcd8039ff44f6eb5aee2cbf732b354c736e90b",
                "md5": "b8c76a685e489161e380640e66fa6c24",
                "sha256": "656a70b10f91c9b79017f74029dde989ae71866e28ad9a7c77dd90744fb0cfdd"
            },
            "downloads": -1,
            "filename": "ypyjson-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "b8c76a685e489161e380640e66fa6c24",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 160926,
            "upload_time": "2023-05-15T22:12:31",
            "upload_time_iso_8601": "2023-05-15T22:12:31.669669Z",
            "url": "https://files.pythonhosted.org/packages/5e/f9/0434ce5147eced6d3a6038fcd8039ff44f6eb5aee2cbf732b354c736e90b/ypyjson-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-15 22:12:31",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ypyjson"
}
        
Elapsed time: 1.78064s