Giter VIP home page Giter VIP logo

orjson's People

Contributors

akx avatar andersk avatar bdraco avatar cdce8p avatar dlobue avatar dr-emann avatar dtolnay avatar ermakov-oleg avatar ijl avatar inevity avatar jakob-keller avatar jamadeo avatar konstin avatar marcoffee avatar messense avatar nazarkostetskiy avatar necaris avatar prettywood avatar pskopnik avatar sd2k avatar vivainio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orjson's Issues

Serialize numpy, pandas natively

numpy and pandas objects could be serialized natively for better performance and convenience. You would currently use default to convert such objects to an intermediate representation, e.g., nparray.tolist(), which is unnecessarily slow.

Alias dataclass field name

When parsing JSON, sometimes the fields need/have horrible names so I think it'd be neat to add an option to specify the JSON field name for encoding/decoding.

Example:

@dataclass
class A:
    b: int = field(metadata={"name": 'anothername'})

orjson.dumps(A(1))
# will print
b'{"anothername": 1}'

Datetime serialization wrong for datetimes with microseconds smaller than 100000

Hi,

I think there is an error in the way microseconds are serialized:

>>> orjson.dumps(datetime.datetime.now().replace(microsecond=10))
b'"2019-09-18T15:26:25.10"'
>>> datetime.datetime.now().replace(microsecond=10).isoformat()
'2019-09-18T15:28:28.000010'

Microseconds are usually given as fractional seconds. Therefore ".10" has a different meaning than ".000010".

Lukas.

Hard Limit Recursion Limit on `default_calls`

Is there a specific reason the value 5 was chosen here?

if self.default_calls > 5 https://github.com/ijl/orjson/blob/master/src/encode.rs#L227

If it's not a hard limit would it be possible to add it as an optional param to dumps() to enable the developer to choose what that limit would be?

I am not a Rust developer but I was able to put together a working proof of concept here:
brianjbuck@eb9cfb8

If you wanted to give feedback I can make edits and possibly a PR if you like.

deserializing list fails

Python 3.7.5 (default, Nov  7 2019, 10:50:52) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import orjson
>>> orjson.loads(b"['foo']")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
json.decoder.JSONDecodeError: expected value at line 1 column 2: line 1 column 1 (char 0)
>>> orjson.__version__
'2.1.4'

Am I doing something wrong?

Floating point number precision problem

OS: Ubuntu 16.04
orjson Version: 2.0.1

In [8]: data = {'lat': 31.245270191439438, 'lng': 121.48791951161945}

In [9]: orjson.loads(orjson.dumps(data))
Out[9]: {'lat': 31.24527019143944, 'lng': 121.48791951161944}

In [10]: json.loads(orjson.dumps(data))
Out[10]: {'lat': 31.245270191439438, 'lng': 121.48791951161945}

black settings not in pyproject.toml

If you are using black perhaps you should include the settings you use in pyproject.toml so other contributors also have them and they get applied automatically.

Something like:

[tool.black]
line-length = 120
target-version = ['py36', 'py37']
skip-string-normalization = "true"

Subtypes of serializable types are not serializable

import json
import orjson

class MyDict(dict):
    pass

my_dict = MyDict({"id": 1})
json.dumps(my_dict) # works
orjson.dumps(my_dict) # fails

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Type is not JSON serializable: MyDict

dumps support sort_keys

It would be nice to have dumps support a 'sort_keys' option that would sort the keys in output dictionaries. This allows me to verify that dumps({"a":"b", "c":"d"}) == dumps({"a":"b", "c":"d"}). Otherwise I have to deserialize them both and do individual key/value compares.

Wrong JSONEncodeError Raised with Default Function

Using a default function is masking true error. Consider the following code:

from collections import OrderedDict

import numpy
import orjson


def default(data):
    if isinstance(data, OrderedDict):
        return dict(data)
    else:
        return data

test_data = OrderedDict({"value": numpy.int32(10)})

orjson.dumps(test_data, default=default)
---------------------------------------------------------------------------
JSONEncodeError                           Traceback (most recent call last)
<ipython-input-8-213d4ac9b625> in <module>
----> 1 orjson.dumps(test_data, default=default)

JSONEncodeError: default serializer exceeds recursion limit

What is actually happening here though is the type numpy.int32 can't be serialized which is fine if the error wasn't a recursion error. What I would expect to see instead is this error:

orjson.dumps(numpy.int32(10))
---------------------------------------------------------------------------
JSONEncodeError                           Traceback (most recent call last)
<ipython-input-3-80a725b81985> in <module>
----> 1 orjson.dumps(numpy.int32(9))

JSONEncodeError: Type is not JSON serializable: numpy.int32

Can not load exception class: {}.{}json.JSONDecodeError

I have some interesting situation with orjson==2.0.6 in my project. I wasn't able to reproduce this issue outside of the project, it means there's probably some strange conflict with existing dependencies or environment. Clean module outside of the project but in the same venv and same imports works absolutely fine.

Any idea what it can be?

Python: 3.6.3

PyCharm output:

thread '<unnamed>' panicked at 'Can not load exception class: {}.{}json.JSONDecodeError: PyErr { type: Py(0x9d0c40, PhantomData) }', src/libcore/result.rs:999:5
stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: PyInit_orjson
  10: _PyImport_LoadDynamicModuleWithSpec
  11: <unknown>
  12: PyCFunction_Call
  13: _PyEval_EvalFrameDefault
  14: <unknown>
  15: <unknown>
  16: _PyEval_EvalFrameDefault
  17: <unknown>
  18: <unknown>
  19: _PyEval_EvalFrameDefault
  20: <unknown>
  21: <unknown>
  22: _PyEval_EvalFrameDefault
  23: <unknown>
  24: <unknown>
  25: _PyEval_EvalFrameDefault
  26: <unknown>
  27: <unknown>
  28: _PyEval_EvalFrameDefault
  29: <unknown>
  30: _PyFunction_FastCallDict
  31: _PyObject_FastCallDict
  32: _PyObject_CallMethodIdObjArgs
  33: PyImport_ImportModuleLevelObject
  34: _PyEval_EvalFrameDefault
  35: <unknown>
  36: PyEval_EvalCode
  37: <unknown>
  38: PyCFunction_Call
  39: _PyEval_EvalFrameDefault
  40: <unknown>
  41: <unknown>
  42: _PyEval_EvalFrameDefault
  43: <unknown>
  44: <unknown>
  45: _PyEval_EvalFrameDefault
  46: <unknown>
  47: <unknown>
  48: _PyEval_EvalFrameDefault
  49: <unknown>
  50: <unknown>
  51: _PyEval_EvalFrameDefault
  52: <unknown>
  53: _PyFunction_FastCallDict
  54: _PyObject_FastCallDict
  55: _PyObject_CallMethodIdObjArgs
  56: PyImport_ImportModuleLevelObject
  57: _PyEval_EvalFrameDefault
  58: <unknown>
  59: PyEval_EvalCode
  60: <unknown>
  61: PyCFunction_Call
  62: _PyEval_EvalFrameDefault
  63: <unknown>
  64: <unknown>
  65: _PyEval_EvalFrameDefault
  66: <unknown>
  67: <unknown>
  68: _PyEval_EvalFrameDefault
  69: <unknown>
  70: <unknown>
  71: _PyEval_EvalFrameDefault
  72: <unknown>
  73: <unknown>
  74: _PyEval_EvalFrameDefault
  75: <unknown>
  76: _PyFunction_FastCallDict
  77: _PyObject_FastCallDict
  78: _PyObject_CallMethodIdObjArgs
  79: PyImport_ImportModuleLevelObject
  80: _PyEval_EvalFrameDefault
  81: <unknown>
  82: PyEval_EvalCode
  83: <unknown>
  84: PyCFunction_Call
  85: _PyEval_EvalFrameDefault
  86: <unknown>
  87: <unknown>
  88: _PyEval_EvalFrameDefault
  89: <unknown>
  90: <unknown>
  91: _PyEval_EvalFrameDefault
  92: <unknown>
  93: <unknown>
  94: _PyEval_EvalFrameDefault
  95: <unknown>
  96: <unknown>
  97: _PyEval_EvalFrameDefault
  98: <unknown>
  99: _PyFunction_FastCallDict

Document that 'bool' is a natively supported type

The readme says:

It natively serializes str, dict, list, tuple, int, float, datetime.datetime, datetime.date, datetime.time, and None instances.

Notice that bool is missing from it. Because the list is so precise, I had to go look through the test suite to confirm that bool is indeed supported.

Support serialization of NamedTuples by default

Hi! It would be cool to have it implemented. So far simplejson seems to be the only one that does it right (stdlib's json serializes named tuples as list values, which is hardly a desired default behaviour):

>>> from simplejson import dumps
>>> from typing import NamedTuple
>>> class X(NamedTuple):
...     x: int
... 
>>> dumps(X(1))
'{"x": 1}'

Memory leak ?

Hello !

I've just tested on data that look like this :

dumped = '{"12999":-634,"13000":-84,"13001":-789,"13002":164,"13003":671,"13004":4262,"13005":4376,"13006":481,"13007":5469,"13008":613,"13009":4736,"13010":4218,"13011":517,"13012":5473,"13013":5404,"13014":4157,"13015":3919,"13016":-497,"13017":580,"13018":3298,"13019":-1018,"13020":-838,"13021":2900,"13022":2862,"13023":828,"13024":3526,"13025":3349,"13026":1051,"13027":1463,"13028":1978,"13029":1316,"13030":4445,"13031":4316,"13032":34,"13033":1861,"13034":5046,"13035":1370,"13036":798,"13037":-679,"13038":3700,"13039":1878,"13040":5263,"13041":5396,"13042":4714,"13043":2642,"13044":5224,"13045":416,"13046":4643,"13047":4461,"13048":5611,"13049":2421,"13050":-68,"13051":2717,"13052":2826,"13053":3578,"13054":-707,"13055":4012,"13056":319,"13057":703,"13058":-1691,"13059":-927,"13060":5496,"13061":4991,"13062":-1246,"13063":320,"13064":2282,"13065":5002,"13066":1944,"13067":3033,"13068":-284,"13069":217,"13070":2993,"13071":2696,"13072":401,"13073":2467,"13074":2410,"13075":-679,"13076":210,"13077":3479,"13078":-1001,"13079":-745,"13080":90,"13081":-1087,"13082":2623,"13083":5934,"13084":-1202,"13085":4531,"13086":3787,"13087":-361,"13088":1814,"13089":584,"13090":-443,"13091":4458,"13092":3784,"13093":-380,"13094":2258,"13095":1905,"13096":1605,"13097":41,"13098":5859}'
%timeit orjson.loads(dumped)

But I see that memory usage increases a lot for the python process, and does not go down.

Thanks !

Can't serialise nested object if that unsupported.

When I try to force type casting nothing happened with nested objects. How to use orjson with nested objects?

Steps to reproduce:

import collections
import orjson

def default(obj):
    if isinstance(obj, dict) and type(obj) != dict:
        return dict(obj)
    return obj

orjson.dumps(
    {
        'key': collections.OrderedDict({}), 
    },
    default=default,
)

Python 3.7.5 (v3.7.5:5c02a39a0b, Oct 14 2019, 18:49:57)
[Clang 6.0 (clang-600.0.57)] on darwin

orjson 2.2.0

datetime support break default function

Before version 2.0.2 we use DjangoJSONEncoder.default to handle datatime, but it doesn't works now, and the orjson datetime is not compatible with the logic below:

https://github.com/django/django/blob/master/django/core/serializers/json.py#L81

def default(self, o):
    # See "Date Time String Format" in the ECMA-262 specification.
    if isinstance(o, datetime.datetime):
        r = o.isoformat()
        if o.microsecond:
            r = r[:23] + r[26:]
        if r.endswith('+00:00'):
            r = r[:-6] + 'Z'
        return r
    elif isinstance(o, datetime.date):
        return o.isoformat()
    elif isinstance(o, datetime.time):
        if is_aware(o):
            raise ValueError("JSON can't represent timezone-aware times.")
        r = o.isoformat()
        if o.microsecond:
            r = r[:12]
        return r
    elif isinstance(o, datetime.timedelta):
        return duration_iso_string(o)
    elif isinstance(o, (decimal.Decimal, uuid.UUID, Promise)):
        return str(o)
    else:
        return super().default(o)

Is there a way to make default works with datetime object?

order of dataframe columns

trying to convert json to pandas dataframe. what does set the order of columns?

json_list = [orjson.loads(line) for line in resp.text.splitlines()]
df = pd.DataFrame(json_list)

where resp is a generic response from an API call.

Unable to serialize OrderedDict

When encoding object that contains an OrderedDict, orison complains about orjson.JSONEncodeError: Type is not JSON serializable: collections.OrderedDict. json from standard library works fine.

Python 3.7.3 on MacOS

add default hook to loads()

Without a default hook in loads, the value of the default hook on dumps is small.

The pattern of having classes with method from_json() and to_json() is really useful when combined with a default hook.

mypy can't find OPT_SERIALIZE_DATACLASS

For some reason mypy doesn't think that OPT_SERIALIZE_DATACLASS exists in the orjson module. I really don't know why this is, it's clearly defined and in the .pyi file, so maybe it's an issue with mypy? Figured I would post it here in case you know why.

My code:

from dataclasses import dataclass
import orjson

@dataclass
class Test:
    value: str

test = Test("hi")
print(orjson.dumps(test, option=orjson.OPT_SERIALIZE_DATACLASS))

mypy's output is " error: Module has no attribute "OPT_SERIALIZE_DATACLASS"

Serialize UUID natively

UUID are used a lot in APIs, it would be super great if they were supported natively. I know we can use the default, but it seems a bit slower (total time of the query) than if I already provide it a previously converted UUID to string.

Pretty output

This has been requested but needs research. What are the use cases? Is bytes output ok? Should it support configurable indent or choose either 2 or 4? What is the API if it is configurable? (Can't specify two conflicting OPT_*.) What settings do major projects like Django, DRF, Flask, etc. use for pretty-printed output? It looks like the formatting around arrays etc. is the same as standard library for a given indentation. What is the performance impact on compact output? What is the performance of orjson and other libraries with pretty output? Needs tests that fixtures print correctly and that any assertions, e.g., it's the same as the standard library's output (nevermind exponents etc), are true.

can I get indent option?

can I get option like OPT_INDENT_4, OPT_INDENT_4
to make human readable json to replace other json libraries

orjson is awesome!! thanks.

Document default examples and edge cases

Hi guys, there is an issue:

Documentation says:
"If no object is returned by the default callable but also no exception was raised, it falls through to raising JSONEncodeError on an unsupported type."

So I expect to see JSONEncodeError in this case
orjson.dumps(Decimal(1), default=lambda *a, **kwargs: None)
but I'm getting b'null'

Version: 2.2.0

Thanks in advance!

Cannot build orjson for raspberry pi 4

When I tried to run pip install orjson in Ubuntu Server 18.04 for Raspberry Pi4, the following error occur:

Collecting orjson
  Using cached https://files.pythonhosted.org/packages/6c/d1/6357446e83e4774efcf9798ee17ec40ba573033f8b2f956bcadc2007a737/orjson-2.0.11.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.6/tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-u6uu263e/orjson/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-u6uu263e/orjson/

There should be a wheel for manylinux stated in pypi, but instead I downloaded tar file and kinda install from source. What happened?

Cannot build cp37 linux armv7l (Raspberry Pi)

There's no wheel for the raspberry pi, and I cannot seem to build it.
The dependencies (maturin mainly) have been built and installed.
I have rust beta (since there doesn't seem to be a nightly published for this platform).

Output from pip3 wheel:

  Successfully installed maturin-0.7.6 toml-0.10.0
  Cleaning up...
  Cleaned build tracker '/tmp/pip-req-tracker-wbgzc9qi'
done
  Running setup.py (path:/tmp/pip-wheel-a9ak7sy7/orjson/setup.py) egg_info for package orjson
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.7/tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-wheel-a9ak7sy7/orjson/setup.py'
Cleaning up...
  Removing source in /tmp/pip-wheel-a9ak7sy7/orjson
Removed orjson from https://files.pythonhosted.org/packages/d0/e2/5042aa4907face747f7d68fa694a5781c07f9263bbaebfeba42a542f1ec3/orjson-2.1.2.tar.gz#sha256=40a6b0c17d94907d5c26ed2225fc465e48aa0eac8fd5d46d01beb105e4db06c1 from build tracker '/tmp/pip-req-tracker-wbgzc9qi'
Removed build tracker '/tmp/pip-req-tracker-wbgzc9qi'
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-wheel-a9ak7sy7/orjson/
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/wheel.py", line 161, in run
    resolver.resolve(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 102, in resolve
    self._resolve_one(requirement_set, req)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 256, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolve.py", line 209, in _get_abstract_dist_for
    self.require_hashes
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 298, in prepare_linked_requirement
    abstract_dist.prep_for_dist(finder, self.build_isolation)
  File "/usr/lib/python3/dist-packages/pip/_internal/operations/prepare.py", line 126, in prep_for_dist
    self.req.run_egg_info()
  File "/usr/lib/python3/dist-packages/pip/_internal/req/req_install.py", line 473, in run_egg_info
    command_desc='python setup.py egg_info')
  File "/usr/lib/python3/dist-packages/pip/_internal/utils/misc.py", line 723, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip._internal.exceptions.InstallationError: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-wheel-a9ak7sy7/orjson/

Deserialize UUID from str

Hello! orjson is an interesting library! Congratulations on the speed. I would switch to it, but for UUID support. Is there any plan for supporting UUIDs like rapidjson, etc?

Support 65+ bit integers

Hi,

We have some ML projects that have been known to generate 67 bit integers. orjson can't deserialize them (thankfully, unlike ujson it actually throws an exception, so I can failsafe to json)

>>> import orjson
>>> orjson.dumps({'key': int('1'*67, 2)})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
orjson.JSONEncodeError: Integer exceeds 64-bit range
>>> value = horcrux._json.dumps({'key': int('1'*67, 2)})
Unable to fastdump JSON, failsafe to stdlib json! [Slow!!]
Traceback (most recent call last):
  File "/Users/autumn/software/horcrux/horcrux/__init__.py", line 36, in fast_dumps
    value: bytes = self.fastjson.dumps(item)
orjson.JSONEncodeError: Integer exceeds 64-bit range
>>> value
'{"key": 147573952589676412927}'
>>> orjson.loads('{"key": 147573952589676412927}')
{'key': 1.4757395258967641e+20}
>>> orjson.dumps(_)
b'{"key":1.4757395258967641e20}'
>>> 147573952589676412927 - 1.4757395258967641e20
0.0

One quick fix suggestion would be to simply cast items larger than int64 to floats as the following works just fine:

>>> orjson.loads('{"key": 1.4757395258967641e20}')
{'key': 1.4757395258967641e+20}

A better one would be to return int for int. Thankfully, I can failsafe to stdlib json to handle the bignums when they come in. πŸ˜ƒ

Join forces with hyperjson?

Hey there,
just found your repo. I'm the author of hyperjson, the other pyo3-based Python module for JSON. I was wondering whether we could join forces and merge both project. From my perspective, this would be beneficial for improving the compatibility with Python's JSON module. Also, we wouldn't have to do the performance work in two places.
We could merge both codebases in one central place.
What do you think?

pip install not working

my pip isn't completely borked afaik. I install ujson as example below.

uname -a
Linux daserver5 4.4.0-166-generic #195-Ubuntu SMP Tue Oct 1 09:35:25 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

sudo -H pip --no-cache install orjson
Collecting orjson
Downloading https://files.pythonhosted.org/packages/6c/d1/6357446e83e4774efcf9798ee17ec40ba573033f8b2f956bcadc2007a737/orjson-2.0.11.tar.gz (502kB)
|################################| 512kB 2.8MB/s
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpnlz0SE
cwd: /tmp/pip-install-5kd1BM/orjson
Complete output (15 lines):
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 257, in
main()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 85, in get_requires_for_build_wheel
backend = _build_backend()
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 63, in _build_backend
obj = import_module(mod_path)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/tmp/pip-build-env-zMe1jh/overlay/lib/python2.7/site-packages/maturin/init.py", line 31
def get_config() -> Dict[str, str]:
^
SyntaxError: invalid syntax

ERROR: Command errored out with exit status 1: /usr/bin/python /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpnlz0SE Check the logs for full command output.

..................................

sudo -H pip --no-cache install ujson
Collecting ujson
Downloading https://files.pythonhosted.org/packages/16/c4/79f3409bc710559015464e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz (192kB)
|################################| 194kB 2.6MB/s
Building wheels for collected packages: ujson
Building wheel for ujson (setup.py) ... done
Created wheel for ujson: filename=ujson-1.35-cp27-cp27mu-linux_x86_64.whl size=62574 sha256=df2b96489b43e481e81fb576c162d1513d4648e20e402cc122783a1fea12efa9
Stored in directory: /tmp/pip-ephem-wheel-cache-kCTAly/wheels/28/77/e4/0311145b9c2e2f01470e744855131f9e34d6919687550f87d1
Successfully built ujson
Installing collected packages: ujson
Successfully installed ujson-1.35

Package installation fails on Windows 10 with Python 3.7.1

Hi, I'm trying to install orjson in a test virtualenv directory, but it seems PyPi does not contain any compatible versions. Here's the verbose log of my attempt to pip install. Is there a way I can solve this?

Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect
Created temporary directory: C:\Users\Mathieu\AppData\Local\Temp\pip-ephem-wheel-cache-3jw2g0g3
Created temporary directory: C:\Users\Mathieu\AppData\Local\Temp\pip-req-tracker-j6p_5dxe
Created requirements tracker 'C:\\Users\\Mathieu\\AppData\\Local\\Temp\\pip-req-tracker-j6p_5dxe'
Created temporary directory: C:\Users\Mathieu\AppData\Local\Temp\pip-install-4zgwnghy
Collecting orjson
  1 location(s) to search for versions of orjson:
  * https://pypi.org/simple/orjson/
  Getting page https://pypi.org/simple/orjson/
  Looking up "https://pypi.org/simple/orjson/" in the cache
  Request header has "max_age" as 0, cache bypassed
  Starting new HTTPS connection (1): pypi.org:443
  https://pypi.org:443 "GET /simple/orjson/ HTTP/1.1" 304 0
  Analyzing links from page https://pypi.org/simple/orjson/
    Skipping link https://files.pythonhosted.org/packages/cb/5d/084b8b7423302a0190cb56b7cab0ab733911087ef89a53673c3fa210c14b/orjson-1.0.0-cp37-cp37m-manylinux1_x86_64.whl#sha256=c5e7648c80cb8c506512bef80c346be62d8b96ae1094ac46591b151d95968201 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/2d/bb/3cd4bcdddd3b7bde2cd470fee2e63be905a7ddb6fd8184dbb6e3f269ae6f/orjson-1.0.1-cp37-cp37m-manylinux1_x86_64.whl#sha256=e53b120072abe2123dbf7f0d362ffb62ef649085a94f1c3d9f2ba066b47c566f (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/34/a6/5d5d50049d0da044175a0c62ecb9fa2dd21067ff2ca1132c77b483bb5ef2/orjson-1.1.0-cp35-cp35m-manylinux1_x86_64.whl#sha256=39e8e3849c547f5a5fe7f3ff07b037db1d5a8e6d565bd75c71d1221333755736 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/31/b9/21779d8b57e2cf4f7ec2402a0b22b77387eaad5dd0283323111f5c6e153e/orjson-1.1.0-cp36-cp36m-manylinux1_x86_64.whl#sha256=71fdf59963978472cce22a7aa9b793b1cc1f4844119ba67dfdbc159b8ded180d (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/2e/9e/fd9ed15a3d63fbd35eb4dc243227998fbe00dc0a3c87167b9265bf4a8e45/orjson-1.1.0-cp37-cp37m-manylinux1_x86_64.whl#sha256=32830217b74420dde167e200f5a8c5a3009358d8093b2f754a8b8d3a13cff6bd (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/71/6e/bd3164908d0386de17b2c3561b66ccd1d62905e913cd589a60236a6cc342/orjson-1.2.0-cp35-cp35m-manylinux1_x86_64.whl#sha256=fde03b16491f2aaa5af2c986a2daa320ec7635799bef5eea391ac9429938cf8a (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/83/81/ee02adc272facb3723d00343388ce62e2c9d9eefd0f0bc03d02941d44814/orjson-1.2.0-cp36-cp36m-manylinux1_x86_64.whl#sha256=e6e34b0938f53e4c49d3c4f5d2969e03ef046e80ad17d5b287b3cec13494e3be (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/bd/6f/c19c00d27f82a9037490bcb84442a7335763d3e0d9db15085173f963dbd5/orjson-1.2.0-cp37-cp37m-manylinux1_x86_64.whl#sha256=954861a4258c8334f3b960b2c7c74a3967eabe083cd54e9eb9c8b8cde6b7631f (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/08/b3/da3bc86be20efebdc63964da12f5fcaee1d387ace48f83b36e1666ff3892/orjson-1.2.1-cp35-cp35m-manylinux1_x86_64.whl#sha256=125a3d396cfe071c246ba3f71a19a50729a9945a2cbfccda7db507b58fba9f82 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/87/b9/c48e9da0067dd50dcfe1819d816d75529aac69d91d501d8edd77fc502303/orjson-1.2.1-cp36-cp36m-manylinux1_x86_64.whl#sha256=1498a05f6edb0f6512783510eb2f7f731f8d2524b2b6b2c17ebc24fbd4237788 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/c8/b8/0c02cd769d35921bec1588e6b7a3c030dc86effc4b54e141a3b96667cb17/orjson-1.2.1-cp37-cp37m-manylinux1_x86_64.whl#sha256=7a7dc4ae1e2c285c758f40f662f7a9bc6e4e04cd09665e94cdfd6a1f966be25c (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/93/f1/cb6e35c8c9398b10e3030e05d1af60cb95dd8daa7e497042e0a4a437f14c/orjson-1.3.0-cp35-cp35m-manylinux1_x86_64.whl#sha256=fb9ab85eb71d0ce846e9d90b48ffd1c55c114f555c6397b2f67939888f96675d (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/29/bd/e51fe8b3b595609d0b2bbb4f6df6fc741a5420045c147308c8c38f76a1dd/orjson-1.3.0-cp36-cp36m-manylinux1_x86_64.whl#sha256=2729ee9bc83caef19012c5c7fe79edba472a2e0671ada6b02f58da34e09f2f68 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/cb/bf/6b7af8a3df27a042aa98e7c81c98a2446c421f3a749747176eb787d5c68e/orjson-1.3.0-cp37-cp37m-manylinux1_x86_64.whl#sha256=f6316d8486b337e91350bb01d445ca31ce097ace71e4ba2b017d049e933d1c8e (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/ce/fd/f44e7dcd23f134db245ac261b112831670ceda7371658e41a3c76eb8bd3c/orjson-1.3.1-cp35-cp35m-manylinux1_x86_64.whl#sha256=0f1afc60c3e9d5aacc887481879d5f33660386e8a942fde810b7aa92bddd5a56 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/49/72/d9de4ec1af4c763f9270711b14bae7e68c7048f7210018eaeafd0b5d1c1e/orjson-1.3.1-cp36-cp36m-manylinux1_x86_64.whl#sha256=c881bed74b3d2b67d869b701535524caf08c19af63a5fe4c5e178713d33bcd8e (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/6d/a1/be070a0e0ef747503620f289109288a2d4b25a30fe98d0d213051106d53f/orjson-1.3.1-cp37-cp37m-manylinux1_x86_64.whl#sha256=32d7cf5e74ea847fb7002e4f8096f5e905d637ec1482778fe49e12b1955f3862 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/58/55/bb975fd7e607acab1c4c18d98a3c490b2ccd29c37ae5c7c8df71f2e7a43b/orjson-2.0.0-cp36-cp36m-macosx_10_7_x86_64.whl#sha256=0c2be5767221746a82d252c2d551a885799d84edc8248682202c130b80baac40 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/7e/fe/2b29c25c5ba0f3be1e457d1177fdd01d8ba24ebbe54af7daaf909414f848/orjson-2.0.0-cp36-cp36m-manylinux1_x86_64.whl#sha256=96e510843f95577a34cff420869c13a6164a34a9d55fc4841063a684f46cd742 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/91/3a/372555959fe583dce932881b9c69ca5332817cbf8ba54e227fb63586b497/orjson-2.0.0-cp37-cp37m-macosx_10_7_x86_64.whl#sha256=c1a326bedf8e296e31c820a0220c5f63f9b85d5c36871c79ba7b34ec4b5d00b0 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/21/50/9c1fc3cf407a6feb21c8d049012a03098ef6c7ee8d274b16a7c8e9f1ba68/orjson-2.0.0-cp37-cp37m-manylinux1_x86_64.whl#sha256=80623ec2edd1fd6184daff9d8d99aeb0787a203a25419875ac6f6b56950cf477 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/d7/42/6ecfec9c48584905e213147ab876b5918e46d892c6e639e2baf617e07b44/orjson-2.0.1-cp35-cp35m-macosx_10_7_x86_64.whl#sha256=4152a6ea29a8900c7feb94e18bffac764ff21b7b06a45c2699d9b5ac4cfb9781 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/f8/e6/030a0cf973691e3225dddbe536522e718999111c553c9e6b2b48fc968bde/orjson-2.0.1-cp35-cp35m-manylinux1_x86_64.whl#sha256=c813c65be50d5732d3562a698aa44edf577ee7b2352a6e61ab990a5a31adb23d (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/85/cd/4ffc3b23a2741b00af013db2bf9ea5a786934718bfcdcb165337f73237a3/orjson-2.0.1-cp35-none-win_amd64.whl#sha256=979eafe91aaaa016c482473f0922794d4d1daee8035a056b0fd939cf945e2c5a (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/c3/0f/3705d47bccefc6c28323e1f14f799657c7e9311a5d951f591ff17e0c26fe/orjson-2.0.1-cp36-cp36m-macosx_10_7_x86_64.whl#sha256=3795f59b5cc861de5c8031a8d13e2cd0dd940984f16b4f9a5128fb25b0947a57 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/85/3f/2193c4b1808bb56377f6c1226bbdd4c140442beffe7bec3806c27acfb9ff/orjson-2.0.1-cp36-cp36m-manylinux1_x86_64.whl#sha256=efd5db16b2425c1f95898d0218a37d598392361b4cff08529ba98bb426fef36f (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/68/d4/233a9d0def0e9e21dde7c1fa3320a69d353334e3f446de427e56ad11c305/orjson-2.0.1-cp36-none-win_amd64.whl#sha256=eeba26ff75fedb0ba2b5bc3f6ab6e3f5cb162e62fdcf47b2f3a37b4d0a29b3ad (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/24/a4/c438197128c38f8175752d5b391049241241909310a99094c2e0a4775242/orjson-2.0.1-cp37-cp37m-macosx_10_7_x86_64.whl#sha256=549ea724e664d7d9a901f6b2991db4126879ab97b6a01010ba6e1cc607ea59b0 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/e1/a6/65acf160d3d4ee4631f0e88aca36e44ec2e54fd07ee6f2f0fb09f2fcc92c/orjson-2.0.1-cp37-cp37m-manylinux1_x86_64.whl#sha256=13bcf0431e170766e7e5746738cf4d15cbe3429a6f23fc42a2178730c228222f (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/d8/6c/39099a92a85be70be60393b6771c4111f91ac0ec448b49b673368b61c338/orjson-2.0.1-cp37-none-win_amd64.whl#sha256=58ff040fe8cb1c491c95908bc7157c48d523e601a60b51d52ddf8dce1c3a9028 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/29/54/31a889a4f9b12abe2fb0c5ffb24704d4de30c3b460c578422a35ceebcf5a/orjson-2.0.2-cp35-cp35m-macosx_10_7_x86_64.whl#sha256=7daa7b02f6070ae1ad70e4e07feb5f8b7b9b1542c14e8452039aec47b091a618 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/33/ff/49fb257999a294f07deb95b8b0bf57113b17e1e80629053dcb02d44b4fa0/orjson-2.0.2-cp35-cp35m-manylinux1_x86_64.whl#sha256=40a8812fe3a70e1ff4cd8c8db355bee3c30bfc19df94400de113b31995ddcd74 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/ce/9b/f1df3d3ed1ea96a52348b4e62c342a66a416da801dd36f39962900710b9a/orjson-2.0.2-cp35-none-win_amd64.whl#sha256=ee8face7746d5f02af8680e380e8caeb8dd29a97406ff20c9add3e89f3a7bc0c (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/d7/7a/d39cfe2bc45d1ef82d4d7ef889b26b74c259b9d37aaa3fb94b506ce1adba/orjson-2.0.2-cp36-cp36m-macosx_10_7_x86_64.whl#sha256=61b4290e308a74036cd96ebb2acdc47c1387c423e82779ba8561af8aa2c445df (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/58/96/3c6691aea37c3843598a45a0eb2624f7cfd69466e58b6338e0ecaa7e1c72/orjson-2.0.2-cp36-cp36m-manylinux1_x86_64.whl#sha256=2bc06e0223567933eac8029bd1a8b3f0aebb1ae5ba29ddb5b77845fb8205ea35 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/54/24/c2b7ac8e244d74a7e05393618547ba10686b7cd422e0070c2ee50cc13363/orjson-2.0.2-cp36-none-win_amd64.whl#sha256=545c7288e625f407776cf1baa31c8ae9695d26ebb929ea36b52a8343712bbff2 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/4f/e7/84cfe2836fb647dcf4fc0e4a8349a28659a6551deb860c33ccd73adb0702/orjson-2.0.2-cp37-cp37m-macosx_10_7_x86_64.whl#sha256=6bf70eefb60dba803dbd9e0c86f7bba7bed02ef9aba70268ef2ff6122f2fd85d (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/2a/04/4acb84ab59329ce5eb476bf926a775c7e457919372418a1f6168a0e866f4/orjson-2.0.2-cp37-cp37m-manylinux1_x86_64.whl#sha256=803424f141238917fea15cb7556670941c998f0da0204d8753100f4962241d2c (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/f8/4d/1a2f390cae6b46cbe5b6367ed006a6aae4ca97fbfb1633a3775ce864c8fb/orjson-2.0.2-cp37-none-win_amd64.whl#sha256=7cdbe0abe073a3513671283cbf69b8bb6c45b3c069941a53d5667f950501ece2 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/0c/88/dea475d5dfcf30dbb5441cc71eb5d1bb23e85fa38f1dc4c61c0b52b13434/orjson-2.0.3-cp35-cp35m-macosx_10_7_x86_64.whl#sha256=bac3ee4ab2f46e41aa2db9143af4af5c1da3488fe3fcec851c2e95c9f7dfe32f (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/ce/38/fa6616a6a9835ab68de91cca5d0d4e8d94e7c5049582c9689dfcf1ef92d3/orjson-2.0.3-cp35-cp35m-manylinux1_x86_64.whl#sha256=d58b76e6fdb2a10a48de6a3ee6eea45978d2341986eb61c253a11c78bddbc7d2 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/1b/60/5c5db9f3bd39e5b6abc3639846965c8811dbe3683f97ce60b6814ba1c983/orjson-2.0.3-cp35-none-win_amd64.whl#sha256=16eda038ce45740983310e58376b2a2f38e3d9c8ece43237147dcd57c0ec8005 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/0d/ae/01189e8b41127250796f340a2401a87765aa484a517a8f98e05ba20c5ed6/orjson-2.0.3-cp36-cp36m-macosx_10_7_x86_64.whl#sha256=9883bb9bfca626939c26a962a23048d9689f495c604ffad5a4ad432e7f8c9203 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/8d/79/e35c910d8a2f829febeeeac13f130de97c05c66025022fcb47a208375524/orjson-2.0.3-cp36-cp36m-manylinux1_x86_64.whl#sha256=af0c35ad9e5459d06477e03361105876c993354dbd2a8079faeb814937a22be2 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/06/cc/b8a68e5ae5a9d9bb583fc9496eda1bf210715c3d73cde05501240be41033/orjson-2.0.3-cp36-none-win_amd64.whl#sha256=9a01e7d492b49d4f7a5c4706de525900ac0040540e4720d8ec1c7ecb05dc1490 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/e0/ef/7cee0078e049d66de34b1189212df2efb95f9810627cb2f30ac377ce386c/orjson-2.0.3-cp37-cp37m-macosx_10_7_x86_64.whl#sha256=48a3ef37b2f414ab730f7b398337933a32e6898844c77a3c5cf7877fbf300e71 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/a7/2f/96d598ae1af2fa9fa0bb8d96ce55e5b4439f191f0eb6ac629d572dc04d09/orjson-2.0.3-cp37-cp37m-manylinux1_x86_64.whl#sha256=16a0921832af3d12e7783aeae89d160e4dd96c5cbc6261c5352ac8c480eac389 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/58/dd/00fbc1cf79c1f44b692eca1a9a71ad8b76e6dd4ae7a6e96b036a62c84dc5/orjson-2.0.3-cp37-none-win_amd64.whl#sha256=fbaaf58cff14ea9c7e477970e26a73133e8ccba0fdb4fbe1bf0f422623e06d6c (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/a9/f7/904fd5063e809c3ce4099222ef3381eaa1b198465e88cdd81cd7b858a01a/orjson-2.0.4-cp35-cp35m-macosx_10_7_x86_64.whl#sha256=52377c5f9004ec4c4f2281b0a01aad9c9e93b27c12030212cfc7c0fcd4412e99 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/cd/f6/db508dc51b01a8f522fae737de394678350c843e70601f6ed889128ff3df/orjson-2.0.4-cp35-cp35m-manylinux1_x86_64.whl#sha256=e867f3e2561e51369f4e712d4737512386d2b1e2cab371e44cc4b0106cb2aa8e (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/ae/36/d409138ca560a5115741f5741f4b0e02108204f2390780b754d4848d3b03/orjson-2.0.4-cp35-none-win_amd64.whl#sha256=a26b72eb7b3708685ad30d3826782c2230363e8e1e93c84a9ad3b6f91b0add1d (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/4a/46/80ac6142532b6a52aeb9ef8b551b85e6f599d815c8a3cd380a0b4d3ad544/orjson-2.0.4-cp36-cp36m-macosx_10_7_x86_64.whl#sha256=9a8153e8517079baf454e0700d6a21f062eb6d926a72b9d466bf9b8e1e624e7b (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/c6/a2/eded31dddbbc246fb0b62a2fa9d2bf463edcf39add8eeae8647995ba611e/orjson-2.0.4-cp36-cp36m-manylinux1_x86_64.whl#sha256=550589b9adbbb9f245b73ea710e2644ccbc7f62093b9b3d34359690f63ed2bf3 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/73/69/09b78359afc1b9e2a6fa8181f636ce30356f5c550610694d5f4f61f7fa6f/orjson-2.0.4-cp36-none-win_amd64.whl#sha256=e5bbeb2e7f02eabc01e5eefd6ccef1aabb3d126ac583d226a6797251c56b5732 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/e1/16/97fee5c2ec3548f9f690c9888e6102b00440b28980eddf2da82ced16fb76/orjson-2.0.4-cp37-cp37m-macosx_10_7_x86_64.whl#sha256=8e6018dfdddde520cf3cc67aa40b7157254c76be165fc96ce75dc20e0a4f1e56 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/a5/07/40cc05d69ce3b32473c27829bd8f263522ba16d4aaaf565deb8805983721/orjson-2.0.4-cp37-cp37m-manylinux1_x86_64.whl#sha256=a69f45887cef5e07d8797d6797501b573e6558f1322b0edae638006f2d32fad3 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/de/6c/5a7543e641a00c9d81778f8eb7e4b9c3746cc9147ccddb843e4a94bad6f0/orjson-2.0.4-cp37-none-win_amd64.whl#sha256=1a58ebada3eefdf58cfc6d37732a9cf579a7033e8708131ba73fed7c08e9f804 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/2d/e3/256afcbe776e796249559de102357cfde2c336313b9c3c8cba5b300a7718/orjson-2.0.5-cp35-cp35m-macosx_10_7_x86_64.whl#sha256=bf7312b5ff68463fb1bc98ba5e046e4e39e864bfa177333d30c7f477b04aa355 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/69/89/dc453b41af1d8b4eb8de97db7a6ce032cbf0728ba9083420a3692fafedb3/orjson-2.0.5-cp35-cp35m-manylinux1_x86_64.whl#sha256=4b7f0c61063e1ff4b1048a5b7017762884a14fa1ba4ae3e763b3ddc5d8f1b783 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/72/72/e082c64509f4162f7be340a364b21bd4876355c2a12b95040de2d84eca6c/orjson-2.0.5-cp35-none-win_amd64.whl#sha256=94e55814252d20e274d6498d82bfa4886258425320ca65a105898c34bd372b87 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/1d/27/0ec151b2bc3a7874ea7ad4d1c3f40c17917544390334948dcd8b015c4d7a/orjson-2.0.5-cp36-cp36m-macosx_10_7_x86_64.whl#sha256=82b77b5167e03e8e35acb10b04bfa46d20ac312ae79418f79c032a4c0d3a92bf (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/f7/a2/155ac36e773da9cda3b11712367248fd7db463dfa6e78a42bfb4a49a089d/orjson-2.0.5-cp36-cp36m-manylinux1_x86_64.whl#sha256=12105e34cf7937d4dd3d2334854c3b208755922c692b7cbf527aeb4f66e0617d (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/7b/19/65d1ebd511d35e634c16baec8573ccfe3335a7ca7cb73160dba0d9c096a4/orjson-2.0.5-cp36-none-win_amd64.whl#sha256=2fde9d6bdcaac47e9b03562a056a93ee2b7a39f1942beee8d275db4f629c8a4d (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/b8/a4/f5d1bc99c3247420247ec1fd1451051991507f8adc62acab47c691dc1f0a/orjson-2.0.5-cp37-cp37m-macosx_10_7_x86_64.whl#sha256=44600616801d14a5b538116a7a6b011e7046e0f800d2558f662436e8cae2b59f (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/48/36/a0bc5b1435eaa746a3ec871e31c0da5ec007bda3b30f3f4b6a9cf013bb4f/orjson-2.0.5-cp37-cp37m-manylinux1_x86_64.whl#sha256=b5ba0cb77dcdc0f13a25064d6ad8770cfb649a170aa52aac5ec65a49e8507a51 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/b9/a0/4a6051f2d2140797b9c2b2161dbb6b53fbb73c6b8c2d5675a57c1426020b/orjson-2.0.5-cp37-none-win_amd64.whl#sha256=6b2ebfb670c6fb9a32d54444cf104e92f95a4e0d8b42e4774bd391b0f790af2c (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/5b/c7/5434139a1c5ccd07d30383e99ced31eedd7a128f3401ccbcdd98d8551a86/orjson-2.0.6-cp35-cp35m-macosx_10_7_x86_64.whl#sha256=ca28f614f28a4a975caee3423596ff55945beb195768d0a67d45197c13117a58 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/73/9d/b8034b77a2e03c41cd64558ec0fe3c13b382291f548d14298c3a291cd2a0/orjson-2.0.6-cp35-cp35m-manylinux1_x86_64.whl#sha256=0a0a67ac3654739e3bc43911af6c80a6277545dba553909ad5f91311ed06616a (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/d6/06/a0e65cca59ec896ac247670820e7231a27121c86d4b903b5956d49a54115/orjson-2.0.6-cp35-none-win_amd64.whl#sha256=ebdc9200ed50b9d6461a9ac3bfeebd15f1ae54b933edaaa052eaccebdec0808b (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/57/86/b00f2bb821485504531cc1d690dc243db6a16eb764f91dbfc9984cf7684a/orjson-2.0.6-cp36-cp36m-macosx_10_7_x86_64.whl#sha256=487cf61b73195b0021aba09f4417cf8a6bcf0a4e42d2add26b75fe2773865bdd (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/3c/eb/e3b9817d2d7b789c4a50cec0976d3c808b7ad317cd575f63d813a0956cae/orjson-2.0.6-cp36-cp36m-manylinux1_x86_64.whl#sha256=3cc1e45fbd0394344e03a6e89f7194f56a57ff168a785efc55e56c3dca925e2c (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/01/ab/ae0bc69ddccbe266ee43a217e19d223706aeb32373b02f1b69f05e022dc1/orjson-2.0.6-cp36-none-win_amd64.whl#sha256=c99daef8b120777ea41d214ef039dcfa08883b31da3d5d74f31371db180efe02 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/e6/27/b66d7af716295cee42cf7f7291795fc3356eb600ef158ebed8e7cda3cbb7/orjson-2.0.6-cp37-cp37m-macosx_10_7_x86_64.whl#sha256=33c89b3884b57b3942eacca801e029dbf4086a9ebde55627abf9831bed73d58c (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/f5/ce/3fd8eb14f939a3f6f41b4b39906e0bcd3dcb1d964d561426e182350bc5d2/orjson-2.0.6-cp37-cp37m-manylinux1_x86_64.whl#sha256=2dc0c8f5946e9a278b1cbb62404ee9a0167afd51e46566694070188485375823 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
    Skipping link https://files.pythonhosted.org/packages/19/b2/07a3ce482e38b9a050c76a6b4ebe3600d806eb1e6173c949ef6f6d97e52c/orjson-2.0.6-cp37-none-win_amd64.whl#sha256=b7def20627d33aafaa54588d54d3bf58d4c5a91c4e935e3bc7c2128a22bfd2d8 (from https://pypi.org/simple/orjson/); it is not compatible with this Python
Cleaning up...
Removed build tracker 'C:\\Users\\Mathieu\\AppData\\Local\\Temp\\pip-req-tracker-j6p_5dxe'
Exception information:
Traceback (most recent call last):
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\cli\base_command.py", line 178, in main
    status = self.run(options, args)
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\commands\install.py", line 352, in run
    resolver.resolve(requirement_set)
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\resolve.py", line 131, in resolve
    self._resolve_one(requirement_set, req)
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\resolve.py", line 294, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\resolve.py", line 242, in _get_abstract_dist_for
    self.require_hashes
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\operations\prepare.py", line 282, in prepare_linked_requirement
    req.populate_link(finder, upgrade_allowed, require_hashes)
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\req\req_install.py", line 198, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "e:\development\flask_projects\test\lib\site-packages\pip\_internal\index.py", line 792, in find_requirement
    'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for orjson

Relax strict enforcing of keys type to string

I would like to use orjson for structlog, but as it turns out, people are dumping arbitrary data for debugging purposes, where you cannot ensure dict key types are always strings.

So I ask, if there is even a technical reason to enforce string keys and if not, if it is possible to optionally relax this constraint...?

Support Default callable + native implementation

Hi,

I've been trying to figure out how to serialize an Enum in a data class. Currently I implemented a default which looks like:

def serialize_default(obj):
    if dataclasses.is_dataclass(obj):
        return dataclasses.asdict(obj)
    if isinstance(obj, Enum):
        return obj.value

result = orjson.dumps(response, default=serialize_default)

If possible, it'd be nice to be able to either have a native enum implementation, or be able to combine the native-options with my non-native default, for example:

def serialize_default(obj):
    if isinstance(obj, Enum):
        return obj.value

# I wish something like this worked
result = orjson.dumps(response, default=orjson.OPT_SERIALIZE_DATACLASS | serialize_default)  

Would this be do-able?

Deserialize into a dataclass

Just wondering, is adding deserialization into dataclasses in scope for the project?

Just so one can do:

out = orjson.dumps(object)
object = orjson.loads(out, Object)

Support python enum in dumps

I have the following dict to serialize:

{ 'localDate': '02/02/2002', 'merchant': '1234', 'id': '54243', 'status': <StatusEnum.ok: 'OK'>, 'trace': 243242}

StatusEnum:

class StatusEnum(str, Enum):
     ok = "OK"
     canceled = "C"
     deleted = "DEL"

This dict works with both json and ujson, serializing to the string value, but with orjson I get the following error:

orjson.JSONEncodeError: Type is not JSON serializable: StatusEnum

I wish to know enough Rust to contribute with this, but it's possible to ujson receive the enum and get the value to the output json string?

load(stream)

Is there a reason orjson does not, should not or cannot support loading from streams (β†’ load() instead of loads())

In my use case (big JSON rendered in Django Rest Framework), memory usage goes up by 60% when using orjson compared to the stdtlib and I suspect part of it being the cast to a bytestring:

# this
orjson.loads(decoded_stream.read())
# instead of
orjson.load(decoded_stream)

Deserialization Performance

Any chance to improve deserialization performance and beat ujson on cases like bellow ?

import ujson
import orjson
import time

# A naive benchmark but it shows what I mean :P
data = '{"a": 1, "b": 2, "c": 3, "d": 4, "e": 5, "f": "useless-bench"}'
u = ujson.loads
o = orjson.loads

t2 = time.time()
for _ in range(0, 1_000_000):
    o(data)
print(time.time() - t2)
# 0.634258508682251

t1 = time.time()
for _ in range(0, 1_000_000):
    u(data)
print(time.time() - t1)
# 0.5261068344116211

I mean, this library is slightly slower in deserialization thanks to a "correct" approach or it's just not optimized enough for this use case ?

Personal Note: thanks for the published wheels :)

ImportError on CentOS 7

Installed with:

pip3 install --user --upgrade orjson

Fails on import:

import orjson
ImportError: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /home/davidgaleano/.local/lib/python3.6/site-packages/orjson.cpython-36m-x86_64-linux-gnu.so)

The python version is 3.6.3, and the CentOS version is 7.4.1708.

rust ICE on nightly-2020-02-19

I've posted the compiler bug at rust-lang/rust#69327 but one of the changes in orjson or a dependency provokes a bug in the rustc compiler. idk what's really changed - I'm just fixing my builds to use an older precompiled orjson wheel from my private pypis πŸ™ƒ

Could not install on Alpine Linux 3.11 and Rust 1.39.0

  error: could not compile `smallvec`.
  warning: build failed, waiting for other jobs to finish...
  error: build failed
  πŸ’₯ maturin failed
    Caused by: Failed to build a native library through cargo
    Caused by: Cargo build finished with "exit code: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --lib --release -- -C target-feature=+sse2 -C link-arg=-s`
  Running `maturin pep517 build-wheel -i python --manylinux=off --rustc-extra-args=-C target-feature=+sse2 --strip=on`
  Error: Command '['maturin', 'pep517', 'build-wheel', '-i', 'python', '--manylinux=off', '--rustc-extra-args=-C target-feature=+sse2', '--strip=on']' returned non-zero exit status 1.

dataclass support

I'd like to add support for orjson.dumps() to serialize dataclass instances.

This is a breaking change: users may rely on instances falling through to default and controlling how an instance is serialized. This would be version 3.

The dataclasses documentation provides field(metadata={...}) for third parties to customize. I'm not aware of standardized usage around this.

The use case I'm aware of right now is a user wanting to not serialize a value.

For that I think something like attr: str = field(metadata={"serialize": False}), and orjson.dumps() requiring an option=OPT_CUSTOM_DATACLASS or such to have that take effect.

Without the need to inspect metadata, serializing a dataclass looks much like serializing a dict. The option is to avoid two additional method calls for metadata if customization isn't needed.

Feedback and use cases are welcome.

Installation fails in PyCharm 2019.2.1

I want to install orjson in a virtual environment of a project in PyCharm.
I use Python 3.7.4. And the packages installed are:

pip list
Package      Version
------------ -------
aiokafka     0.5.2
kafka-python 1.4.6
pip          19.0.3
setuptools   41.4.0

Trying to install orjson, the following error occurs:

Collecting orjson
  Using cached https://files.pythonhosted.org/packages/6c/d1/6357446e83e4774efcf9798ee17ec40ba573033f8b2f956bcadc2007a737/orjson-2.0.11.tar.gz
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
    Preparing wheel metadata: started
    Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: orjson
  Building wheel for orjson (PEP 517): started
  Building wheel for orjson (PEP 517): finished with status 'error'
  Complete output from command E:\TELEFONICA\venv37\Scripts\python.exe E:\TELEFONICA\venv37\lib\site-packages\pip-19.0.3-py3.7.egg\pip\_vendor\pep517\_in_process.py build_wheel C:\Users\Alten\AppData\Local\Temp\tmp0u5e1tm7:
  Running `maturin pep517 build-wheel -i python --manylinux=off --rustc-extra-args=-C target-feature=+sse2 --strip=on`
     Compiling proc-macro2 v1.0.5
     Compiling unicode-xid v0.2.0
     Compiling syn v1.0.5
     Compiling semver-parser v0.7.0
     Compiling cfg-if v0.1.10
     Compiling ryu v1.0.0
     Compiling serde v1.0.101
     Compiling memchr v2.2.1
     Compiling getrandom v0.1.12
     Compiling lazy_static v1.4.0
     Compiling winapi v0.3.8
  error: could not compile `getrandom`.
  warning: build failed, waiting for other jobs to finish...
  error: could not compile `ryu`.
  warning: build failed, waiting for other jobs to finish...
  error: could not compile `serde`.
  warning: build failed, waiting for other jobs to finish...
  error: could not compile `syn`.
  warning: build failed, waiting for other jobs to finish...
  error: could not compile `proc-macro2`.
  warning: build failed, waiting for other jobs to finish...
  error: could not compile `memchr`.
  warning: build failed, waiting for other jobs to finish...
  error: could not compile `winapi`.
  
  To learn more, run the command again with --verbose.
  ðŸ’Β₯ maturin failed
    Caused by: Failed to build a native library through cargo
    Caused by: Cargo build finished with "exit code: 101": `cargo rustc --message-format json --manifest-path Cargo.toml --lib --release -- -C target-feature=+sse2 -C link-arg=-s`
  Error: Command '['maturin', 'pep517', 'build-wheel', '-i', 'python', '--manylinux=off', '--rustc-extra-args=-C target-feature=+sse2', '--strip=on']' returned non-zero exit status 1.
  
  ----------------------------------------
  Running setup.py clean for orjson
  Complete output from command E:\TELEFONICA\venv37\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Alten\\AppData\\Local\\Temp\\pycharm-packaging\\orjson\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ModuleNotFoundError: No module named 'setuptools'
  
  ----------------------------------------
Failed to build orjson

    Subprocess output does not appear to be encoded as cp1252
  Failed building wheel for orjson
  Failed cleaning build dir for orjson
Could not build wheels for orjson which use PEP 517 and cannot be installed directly

Running the command from the system terminal, the same error occurs.

Is there any version of the orjson library already compiled?

Thanks in advance for the help.

Details of PyCharm:
PyCharm 2019.2.1 (Professional Edition)
Build #PY-192.6262.63, built on August 22, 2019
Runtime version: 11.0.3+12-b304.39 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 1981M
Cores: 8
Registry: debugger.watches.in.variables=false
Non-Bundled Plugins:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.