Skip to content
Snippets Groups Projects
Unverified Commit 42de4c23 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

added GIL

parent 384b2a3f
No related branches found
No related tags found
No related merge requests found
Pipeline #60975 passed with stages
in 1 minute and 27 seconds
stages:
- test
- build
- deploy
pages:
stage: build
......@@ -58,17 +59,33 @@ test_python311:
.build_python:
only:
- master
- tags
except:
- branches
stage: build
script:
- pip install --break-system-packages --upgrade Cython setuptools pip
- pip install --break-system-packages -r requirements.txt
- python setup.py bdist_wheel
- cp dist/*.whl .
after_script:
- pip install twine
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
artifacts:
paths:
- "*.whl"
upload_python311_armv7l:
image: zoo.smok.co/build/build:latest
stage: deploy
dependencies:
- build_python311_armv7l
script:
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
only:
- tags
except:
- branches
build_python38:
extends: .build_python
......@@ -92,3 +109,5 @@ build_python311:
build_python311_armv7l:
extends: .build_python
image: zoo.smok.co/build/build:armv7l-python3.11
after_script:
- echo "Do nothing"
MiniJSON
========
![Passing CI](https://github.com/smok-serwis/minijson/actions/workflows/main.yml/badge.svg)
[![Build status](https://git.dms-serwis.com.pl/smokserwis/minijson/badges/master/pipeline.svg)](https://git.dms-serwis.com.pl/smokserwis/minijson)
[![coverage report](https://git.dms-serwis.com.pl/smokserwis/minijson/badges/master/coverage.svg)](https://git.dms-serwis.com.pl/smokserwis/minijson/-/commits/develop)
[![Maintainability](https://api.codeclimate.com/v1/badges/20392a075de646680403/maintainability)](https://codeclimate.com/github/smok-serwis/minijson/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/20392a075de646680403/test_coverage)](https://codeclimate.com/github/smok-serwis/minijson/test_coverage)
[![Issue Count](https://codeclimate.com/github/smok-serwis/minijson/badges/issue_count.svg)](https://codeclimate.com/github/smok-serwis/minijson)
[![Documentation Status](https://readthedocs.org/projects/minijson/badge/?version=latest)](http://minijson.readthedocs.io/en/latest/?badge=latest)
[![PyPI](https://img.shields.io/pypi/pyversions/minijson.svg)](https://pypi.python.org/pypi/minijson)
[![PyPI version](https://badge.fury.io/py/minijson.svg)](https://badge.fury.io/py/minijson)
[![PyPI](https://img.shields.io/pypi/implementation/minijson.svg)](https://pypi.python.org/pypi/minijson)
......
......@@ -4,7 +4,8 @@ Changelog
v3.1.0
------
Moved entirely to SMOKs' build architecture.
* Moved entirely to SMOKs' build architecture.
* support for Python 3.7 and 3.6 dropped
v3.0.1
------
......
......@@ -22,7 +22,7 @@ copyright = '2021 Dronehub Group sp. z o. o.'
author = 'Piotr Maślanka'
# The full version, including alpha/beta/rc tags
release = '2.0'
release = '3.1.0'
# -- General configuration ---------------------------------------------------
......
......@@ -28,6 +28,10 @@ is anyway invalid JSON_.
.. _JSON: https://www.w3schools.com/js/js_json_objects.asp
.. note::
Now I can officially state that minijson is better than same data exported to
JSON and encoded with best gzip. Enjoy!
Indices and tables
==================
......
......@@ -18,12 +18,14 @@ Type Value consists of:
with len of (value & 0x7F)
* If value's two highest bits are 0100 or 0101, then four lowest bits encode the number of elements,
and the four highest bits encode type of the object:
* 0100 - a list
* 0101 - an object whose keys are all strings
* 0110 - an object whose keys are not all strings (see value of 19 and 20 to know how it's
represented).
* Standard representation for a non-key-string object (value 19), string key object (value 11) or list (value 7) follows,
sans the element count.
* If value is zero, then next character is the length of the string followed by the string
* If value is 1, then next data is signed int
* If value is 2, then next data is signed short
......@@ -64,13 +66,13 @@ Type Value consists of:
* If value is 22, then it's True
* If value is 23, then it's False
* If value is 24, then next what comes is count of bytes, and then bytes follow. This is to be
interpreted as a signed integer
interpreted as a signed integer
* If value is 25, then next comes an unsigned char denoting the length of the bytes, and
the remainder is binary data
the remainder is binary data
* If value is 26, then next comes an unsigned short denoting the length of the bytes, and
the remainder is binary data
the remainder is binary data
* If value is 27, then next comes an unsigned int denoting the length of the bytes, and
the remainder is binary data
the remainder is binary data
Coder **should** encode the value as one having the smallest binary representation, but that is not
Encoder **should** encode the value as one having the smallest binary representation, but that is not
required. Decoder **must** parse any arbitrary valid string.
......@@ -17,12 +17,6 @@ MiniJSON implements the same interface as json or yaml, namely:
.. autofunction:: minijson.parse
For serializing objects you got the following:
.. autofunction:: minijson.dumps_object
.. autofunction:: minijson.loads_object
And the following exceptions:
.. autoclass:: minijson.MiniJSONError
......
......@@ -9,14 +9,17 @@ class MiniJSONError(ValueError):
Note that it inherits from :code:`ValueError`.
"""
pass
class EncodingError(MiniJSONError):
"""Error during encoding"""
pass
class DecodingError(MiniJSONError):
"""Error during decoding"""
pass
cdef:
......
......@@ -17,8 +17,6 @@ project_urls =
classifier =
Development Status :: 5 - Production/Stable
Programming Language :: Python
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
......
import json
import typing as tp
import unittest
import gzip
from minijson import dumps, loads, dumps_object, loads_object, EncodingError, DecodingError, \
switch_default_double, switch_default_float, MiniJSONEncoder
......@@ -7,6 +9,12 @@ from minijson import dumps, loads, dumps_object, loads_object, EncodingError, De
class TestMiniJSON(unittest.TestCase):
def test_gzip_competition(self):
a = {'test': [1, 2, 3], 'bagietka': 'bagietka'}
b = dumps(a)
c = gzip.compress(json.dumps(a).encode(('utf-8')))
self.assertLess(len(b), len(c))
def test_encoder_strict_output(self):
enc = MiniJSONEncoder(use_strict_order=True)
enc.encode({"test": "2", "value": 2})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment