GithubHelp home page GithubHelp logo

kijewski / pyjson5 Goto Github PK

View Code? Open in Web Editor NEW
130.0 130.0 6.0 320 KB

A JSON5 serializer and parser library for Python 3 written in Cython.

Home Page: https://pyjson5.readthedocs.io

License: Apache License 2.0

Makefile 0.60% Python 10.98% C++ 56.48% Cython 31.94%
cpython json json5 library python python3

pyjson5's People

Contributors

dependabot[bot] avatar kijewski avatar pcorpet avatar q-ten 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

pyjson5's Issues

loads: OverflowError while decoding too big escaped Unicode character

pyjson5.loads(r'{\U11111111: 2}')

File src/_decoder.pyx:509, in pyjson5.pyjson5._decode_identifier_name()

File src/_decoder.pyx:113, in pyjson5.pyjson5._get_hex_character()

File src/_raise_decoder.pyx:39, in pyjson5.pyjson5._raise_expected_s()

OverflowError: %c arg not in range(0x110000)

Should raise a Json5DecoderException instead

Installation issue on MacOS - ARM chip

Hi,

I am unable to install this lib. I am reporting here what I am using and the errors I am getting. I am wondering whether I am missing something or if it's indeed expected not to be able to install it on these versions.

Python: 3.10.13
Mac OS: 14.2.1, Chip Apple M1 Pro
Poetry: 1.6.1
Issue returned (partially omitted since the output was too long):

Installing dependencies from lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing pyjson5 (1.6.5): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-13.5-arm64-cpython-310
  creating build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  copying src/pyjson5/__init__.py -> build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  running egg_info
  writing src/pyjson5.egg-info/PKG-INFO
  writing dependency_links to src/pyjson5.egg-info/dependency_links.txt
  writing top-level names to src/pyjson5.egg-info/top_level.txt
  reading manifest file 'src/pyjson5.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching 'requires.txt'
  adding license file 'LICENSE'
  writing manifest file 'src/pyjson5.egg-info/SOURCES.txt'
  copying src/pyjson5/__init__.pyi -> build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  copying src/pyjson5/py.typed -> build/lib.macosx-13.5-arm64-cpython-310/pyjson5
  running build_ext
  Compiling pyjson5.pyx because it changed.
  [1/1] Cythonizing pyjson5.pyx
  building 'pyjson5.pyjson5' extension
  creating build/temp.macosx-13.5-arm64-cpython-310
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -Isrc -I/var/folders/s9/nvj_sch51rn89b44pgzk5fpr0000gp/T/tmp2242py13/.venv/include -I/Users/seba/.pyenv/versions/3.10.13/include/python3.10 -c pyjson5.cpp -o build/temp.macosx-13.5-arm64-cpython-310/pyjson5.o -std=c++11 -O3 -fPIC -ggdb1 -pipe -fomit-frame-pointer -fstack-protector-strong
  In file included from pyjson5.cpp:58:
  In file included from /Users/seba/.pyenv/versions/3.10.13/include/python3.10/Python.h:25:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
          unsigned char   *_base;
                          ^
   .....
  
                                                 ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:643:17: note: declared here
  template <class _A1, class _A2>
                  ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:646:58: error: expected unqualified-id
                                  std::__promote<_A1, _A2> >::type
                                                           ^
  In file included from pyjson5.cpp:1266:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:833:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:456:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_compound.h:14:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_fundamental.h:14:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: use of undeclared identifier 'nullptr_t'; did you mean 'nullptr'?
  template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                  ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:24:49: error: template argument for template type parameter must be a type
  template <>          struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
                                                  ^~~~~~~~~
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__type_traits/is_null_pointer.h:23:17: note: template parameter is declared here
  template <class _Tp> struct __is_nullptr_t_impl       : public false_type {};
                  ^
  In file included from pyjson5.cpp:1267:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/utility:277:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cstdlib:90:5: error: <cstdlib> tried including <stdlib.h> but didn't find libc++'s <stdlib.h> header.           This usually means that your header search paths are not configured properly.           The header search paths should contain the C++ Standard Library headers before           any C Standard Library, and you are probably using compiler flags that make that           not be the case.
  #   error <cstdlib> tried including <stdlib.h> but didn't find libc++'s <stdlib.h> header. \
      ^
  In file included from pyjson5.cpp:1268:
  In file included from ./src/native.hpp:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/array:122:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdexcept:47:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:199:45: error: field has incomplete type 'exception_ptr'
      _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                              ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:194:24: note: definition of 'std::exception_ptr' is not complete until the closing '}'
  class _LIBCPP_TYPE_VIS exception_ptr
                         ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:199:5: error: '__abi_tag__' attribute only applies to structs, variables, functions, and namespaces
      _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
      ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:709:37: note: expanded from macro '_LIBCPP_INLINE_VISIBILITY'
  #  define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI
                                      ^
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:688:26: note: expanded from macro '_LIBCPP_HIDE_FROM_ABI'
            __attribute__((__abi_tag__(_LIBCPP_TOSTRING(_LIBCPP_VERSIONED_IDENTIFIER))))
                           ^
  In file included from pyjson5.cpp:1268:
  In file included from ./src/native.hpp:4:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/array:122:
  In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdexcept:47:
  /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:199:55: error: expected ';' at end of declaration list
      _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
                                                        ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  193 warnings and 20 errors generated.
  error: command '/usr/bin/clang' failed with exit code 1
  

  at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/chef.py:147 in _prepare
      143│ 
      144│                 error = ChefBuildError("\n\n".join(message_parts))
      145│ 
      146│             if error is not None:
    → 147│                 raise error from None
      148│ 
      149│             return path
      150│ 
      151│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with pyjson5 (1.6.5) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "pyjson5 (==1.6.5)"'.

Fails to build on Ubuntu 16.04

Hi,

This looks interesting, but it wouldn't build on Ubuntu 16.04:

creating build/temp.linux-x86_64-3.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Isrc -I/home/BHDGSYSTEMATIC.COM/rblackbourn/Development/Scratch/python/json-example/.venv/include -I/usr/include/python3.7m -c pyjson5.cpp -o build/temp.linux-x86_64-3.7/pyjson5.o -std=c++11 -O2 -fPIC -ggdb1 -pipe -fomit-frame-pointer -fstack-protector-strong
pyjson5.cpp: In function ‘bool __pyx_f_7pyjson5__encode_datetime(__pyx_t_7pyjson5_WriterRef, PyObject*, __pyx_t_7pyjson5_EncType)’:
pyjson5.cpp:49259:38: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
 __pyx_t_4 = PyUnicode_AsUTF8AndSize(__pyx_v_stringified, (&__pyx_v_length)); if (unlikely(__pyx_t_4 == ((char *)NULL))) __PYX_ERR(11, 257, __pyx_L1_error)
                                      ^
pyjson5.cpp: In function ‘bool __pyx_f_7pyjson5__encode_numeric(__pyx_t_7pyjson5_WriterRef, PyObject*, __pyx_t_7pyjson5_EncType)’:
pyjson5.cpp:49720:38: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
 __pyx_t_7 = PyUnicode_AsUTF8AndSize(__pyx_v_formatter_string, (&__pyx_v_length)); if (unlikely(__pyx_t_7 == ((char *)NULL))) __PYX_ERR(11, 309, __pyx_L1_error)
                                    ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Looks like a simple cast problem?

dumps kwarg "default" is not handled the same as json's.

In the regular json module, you can specify a default parameter to json.dumps, which is an alternative to serializing non-jsonable objects. The behaviour of this should ideally be the same with json5, but it's not. Here is a reproducible copy done in IPython:

In [7]: def serialize(obj):
   ...:     return {a: getattr(obj, a) for a in obj.__slots__}
   ...:

In [8]: class Thing:
   ...:     __slots__ = ("hello", "world")
   ...:     def __init__(self):
   ...:         self.hello = 5
   ...:         self.world = 6

In [9]: type(json.dumps(Thing(), default=serialize)), json.dumps(Thing(), default=serialize)
Out[9]: (str, '{"hello": 5, "world": 6}')

In [10]: type(json5.dumps(Thing(), default=serialize)), json5.dumps(Thing(), default=serialize)
Out[10]: (dict, {'hello': 5, 'world': 6})

pyjson5 package fails to install on Apple M1 mini

When I try to install the pyjson5 package, it fails due to compiler errors. See the message below. The issue is caused by name conflict between src/VERSION and C++ #include . File names are case insensitive on MacOS.

I tried to move files VERSION and DESCRIPTION to the top level, and it helped. I can submit a pull request, if you find it useful.

Thanks,
--Serge

$ pip3 install pyjson5 
Collecting pyjson5
  Using cached pyjson5-1.5.1.tar.gz (225 kB)
Building wheels for collected packages: pyjson5
  Building wheel for pyjson5 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Library/Developer/CommandLineTools/usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/8l/gxp7qhcn32xgfkdm22_gjnkh0000gn/T/pip-install-aobry_ij/pyjson5_d1489f32e3fe4ec4a25721df7ea21cda/setup.py'"'"'; __file__='"'"'/private/var/folders/8l/gxp7qhcn32xgfkdm22_gjnkh0000gn/T/pip-install-aobry_ij/pyjson5_d1489f32e3fe4ec4a25721df7ea21cda/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/8l/gxp7qhcn32xgfkdm22_gjnkh0000gn/T/pip-wheel-32xrapt7
       cwd: /private/var/folders/8l/gxp7qhcn32xgfkdm22_gjnkh0000gn/T/pip-install-aobry_ij/pyjson5_d1489f32e3fe4ec4a25721df7ea21cda/
  Complete output (140 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'pyjson5' extension
  creating build
  creating build/temp.macosx-10.14.6-arm64-3.8
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Isrc -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c pyjson5.cpp -o build/temp.macosx-10.14.6-arm64-3.8/pyjson5.o -std=c++11 -O3 -fPIC -ggdb1 -pipe -fomit-frame-pointer -fstack-protector-strong
  In file included from pyjson5.cpp:4:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:63:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/pyport.h:212:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:309:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:417:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:37:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:4:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:63:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/pyport.h:212:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:309:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:417:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cstddef:49:9: error: no member named 'ptrdiff_t' in the global namespace
  using ::ptrdiff_t;
        ~~^
  In file included from pyjson5.cpp:4:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:63:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/pyport.h:212:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:309:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:418:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:4:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/Python.h:63:
  In file included from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8/pyport.h:212:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/math.h:310:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/limits:121:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:615:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:309:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:616:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/utility:205:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:115:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:419:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional_base:15:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/typeinfo:60:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/exception:83:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:115:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:419:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional_base:17:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/new:93:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:115:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:423:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:115:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:562:13: error: unknown type name 'ptrdiff_t'
      typedef ptrdiff_t difference_type;
              ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:623:56: error: unknown type name 'ptrdiff_t'
  template<class _Category, class _Tp, class _Distance = ptrdiff_t,
                                                         ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:989:66: error: unknown type name 'ptrdiff_t'
            class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                                                                   ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:989:54: error: template parameter missing a default argument
            class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                                                       ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/iterator:989:27: note: previous default template argument defined here
            class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
                            ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:116:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:677:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/tuple:154:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:116:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:681:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:576:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__threading_support:14:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/chrono:831:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:116:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:681:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:581:
  src/version:1:1: error: expected unqualified-id
  "1.5.1"
  ^
  In file included from pyjson5.cpp:617:
  In file included from ./src/native.hpp:4:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/array:116:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:643:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:681:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1052:73: error: unknown type name 'ptrdiff_t'
  _Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                          ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1057:65: error: unknown type name 'ptrdiff_t'
  _Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                  ^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/atomic:1073:73: error: unknown type name 'ptrdiff_t'
  _Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT {
                                                                          ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  error: command 'clang' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyjson5

Installation difficulty on Windows starting v1.6.1

Hi,

since the delivery of 1.6.1, I am facing issue to install pyjson5 on Windows. I have the following that doesn't appear with 1.6.0 ( and didn't with 1.6.0.post1).

Installing the following didn't solve the issue:

  • Microsoft Visual C++ 2015-2019 Redistributable (x64) v14.29.30139.0
  • Microsoft Visual C++ 2015-2019 Redistributable (x86) v14.29.30139.0
  • Visual Studio Build Tool 2019 v16.11.9

C:>pip install -U pyjson5
Requirement already satisfied: pyjson5 in c:\users\lpinson\appdata\local\programs\python\python39\lib\site-packages (1.6.0)
Collecting pyjson5
Using cached pyjson5-1.6.1.tar.gz (231 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyjson5
Building wheel for pyjson5 (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for pyjson5 (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [76 lines of output]
running bdist_wheel
running build
running build_py
running egg_info
writing src\pyjson5.egg-info\PKG-INFO
writing dependency_links to src\pyjson5.egg-info\dependency_links.txt
writing top-level names to src\pyjson5.egg-info\top_level.txt
reading manifest file 'src\pyjson5.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'requires.txt'
adding license file 'LICENSE'
running build_ext
skipping 'pyjson5.cpp' Cython extension (up-to-date)
building 'pyjson5.pyjson5' extension
Traceback (most recent call last):
File "C:\Users\lpinson\AppData\Local\Programs\Python\Python39\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 363, in
main()
File "C:\Users\lpinson\AppData\Local\Programs\Python\Python39\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "C:\Users\lpinson\AppData\Local\Programs\Python\Python39\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 261, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools\build_meta.py", line 229, in build_wheel
return self._build_with_temp_dir(['bdist_wheel'], '.whl',
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools\build_meta.py", line 214, in build_with_temp_dir
self.run_setup()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools\build_meta.py", line 157, in run_setup
exec(compile(code, file, 'exec'), locals())
File "setup.py", line 10, in
setup(
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_init
.py", line 155, in setup
return distutils.core.setup(**attrs)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\core.py", line 148, in setup
return run_commands(dist)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\core.py", line 163, in run_commands
dist.run_commands()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 967, in run_commands
self.run_command(cmd)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 299, in run
self.run_command('build')
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 986, in run_command
cmd_obj.run()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 79, in run
_build_ext.run(self)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 448, in build_extensions
self._build_extensions_serial()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 473, in _build_extensions_serial
self.build_extension(ext)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 528, in build_extension
objects = self.compiler.compile(sources,
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 327, in compile
self.initialize()
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 224, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools\msvc.py", line 316, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "C:\Users\lpinson\AppData\Local\Temp\pip-build-env-cm_jlz5o\overlay\Lib\site-packages\setuptools\msvc.py", line 270, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
setuptools._distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pyjson5
Failed to build pyjson5
ERROR: Could not build wheels for pyjson5, which is required to install pyproject.toml-based projects

supply_bytes=True in encode_* brings a headache to me

Hi there, I'm currently working on personal l10n system that can use different JSON parsing implementations.
It looks something like this:

import json
from types import ModuleType

class L10n:
    def __init__(json_impl: ModuleType = json)
        self.json_impl = json_impl

    def load(file):
        self.json_impl.load(file, indent=2, ensure_ascii=False)

    def dump(data, file):
        self.json_impl.dump(data, file, indent=2, ensure_ascii=False)

Of course, we are expecting the same interface as builtin json have.

Because pyjson5.dump(...) and other encode functions have supply_bytes=True, it throws an error:

  File "C:\Users\User\PycharmProjects\l10n\sl10n\process.py", line 93, in apply_postmodifiers
    self.json_impl.dump(data, f, indent=2, ensure_ascii=False)
  File "src/_legacy.pyx", line 100, in pyjson5.pyjson5.dump
  File "src/_exports.pyx", line 562, in pyjson5.pyjson5.encode_io
  File "src/_encoder.pyx", line 439, in pyjson5.pyjson5._encode_callback_bytes
  File "src/_encoder.pyx", line 422, in pyjson5.pyjson5._encode
  File "src/_encoder.pyx", line 381, in pyjson5.pyjson5._encode_other
  File "src/_encoder.pyx", line 232, in pyjson5.pyjson5._encode_mapping
  File "src/_writer_callback.pyx", line 9, in pyjson5.pyjson5._WriterCbBytes_append_c
TypeError: write() argument must be str, not bytes

I know that changing defaults would break old code, so is there any way we can fix this?

dumps: ValueError while escaping excessively long integers

Input was: '0XAA444444bbbbbbbbbbbbbbbbbbbbbbbbbb444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb44444444444444444444444444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb44444444444444444444444444444444444444444bbbbbbbddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb44444444444444444444444444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb44444444444444444444444444444444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb44444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddbbbbb4444444444444444400000000555500000000044445444444444444bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb444444444444444444444444444410E0'

ValueError: Exceeds the limit (4300 digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit

File "src/_encoder.pyx", line 294, in pyjson5.pyjson5._encode_format_string
formatted = PyUnicode_Format(fmt, data)

Should raise a Json5EncoderException instead.

Pylance GeneralTypeIssue

Very minor issue. The below code runs, but Pyright is upset about pyjson5.dump(). It doesn't react to regular json.

    import pyjson5
    file = 'path'
    cache = dict()
    with open(file, 'w') as f:
        pyjson5.dump(cache, f)
                            ^
Argument of type "TextIOWrapper" cannot be assigned to parameter "fp" of type "_SupportsWrite[str]" in function "dump"
  "TextIOWrapper" is incompatible with "_SupportsWrite[str]"

Pylance(reportGeneralTypeIssues)

(variable) f: TextIOWrapper

Windows support

Hi, thank you for this great library, it runs great under Linux!

Are you planning to support Windows? The installation fails due to the use of __int128 and __builtin_expect which CL does not know. From looking at your it looks like __int128 could be replaced with multiple smaller integers and __builtin_expect could be disabled via a macro.

Cheers,
Johannes

v1.4.9 - failed installation

I trying install new version, but can't. Error in third-party library

OS: Alpine 3.12
Python: 3.9.2

Running setup.py clean for pyjson5
#10 90.67   ERROR: Command errored out with exit status 1:
#10 90.67    command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/usr/local/tmp/pip-wheel-7m5nrdlj/pyjson5_e9d7317cbac145b0bc1cb6cbc4ff82fc/setup.py'"'"'; __file__='"'"'/usr/local/tmp/pip-wheel-7m5nrdlj/pyjson5_e9d7317cbac145b0bc1cb6cbc4ff82fc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /usr/local/tmp/pip-wheel-xajs94b4
#10 90.67        cwd: /usr/local/tmp/pip-wheel-7m5nrdlj/pyjson5_e9d7317cbac145b0bc1cb6cbc4ff82fc/
#10 90.67   Complete output (12 lines):
#10 90.67   running bdist_wheel
#10 90.67   running build
#10 90.67   running build_ext
#10 90.67   building 'pyjson5' extension
#10 90.67   creating build
#10 90.67   creating build/temp.linux-x86_64-3.9
#10 90.67   gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc -I/usr/local/include/python3.9 -c pyjson5.cpp -o build/temp.linux-x86_64-3.9/pyjson5.o -std=c++11 -O3 -fPIC -ggdb1 -pipe -fomit-frame-pointer -fstack-protector-strong
#10 90.67   pyjson5.cpp:621:10: fatal error: third-party/fast_double_parser/include/fast_double_parser.h: No such file or directory
#10 90.67     621 | #include "third-party/fast_double_parser/include/fast_double_parser.h"
#10 90.67         |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#10 90.67   compilation terminated.
#10 90.67   error: command '/usr/bin/gcc' failed with exit code 1
#10 90.67   ----------------------------------------
#10 90.67   ERROR: Failed building wheel for pyjson5

Add Conda support

This fantastic extension just blows https://github.com/dpranke/pyjson5 out of the water in terms of performance (as in 3 orders of magnitude for loads), which probably makes sense given it is cython :)

However unlike that library, this is only installable via pip, not conda as well. Would you be able to add conda support?

1.6.0: pep517 build fails

Looks like json5 module is not ready for pep517 type of build

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting dependencies for wheel...
running egg_info
creating src/pyjson5.egg-info
writing manifest file 'src/pyjson5.egg-info/SOURCES.txt'
warning: no files found matching 'pyjson5.cpp'
warning: no files found matching 'requires.txt'
warning: no files found matching 'third-party/fast_double_parser/include/fast_double_parser.h'
writing manifest file 'src/pyjson5.egg-info/SOURCES.txt'
* Building wheel...
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/pyjson5
copying src/pyjson5/__init__.py -> build/lib.linux-x86_64-3.8/pyjson5
copying src/pyjson5/__init__.pyi -> build/lib.linux-x86_64-3.8/pyjson5
copying src/pyjson5/py.typed -> build/lib.linux-x86_64-3.8/pyjson5
running build_ext
creating build/temp.linux-x86_64-3.8
/usr/bin/gcc -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -fPIC -Isrc -I/usr/include/python3.8 -c pyjson5.cpp -o build/temp.linux-x86_64-3.8/pyjson5.o -std=c++11 -O3 -fPIC -ggdb1 -pipe -fomit-frame-pointer -fstack-protector-strong
cc1plus: fatal error: pyjson5.cpp: No such file or directory
compilation terminated.
error: command '/usr/bin/gcc' failed with exit code 1

ERROR Backend subproccess exited when trying to invoke build_wheel

Type hints

PEP 484 introduced static type hints for Python. Would you agree to include and distribute typing stubs with this library?

I can start a PR if you agree.

builds fails on raspberry pi 4 due to usage of __int128

I'm not an expert on C++, but as far as I can tell the build fails on the pi because the compiler doesn't support the __int128 type. I read that this type should not even be used because of portability problems, so the question is if it will be changed at some point. Is it really necessary to use such a large data type for parsing?

Compile wheels for Windows

Would it be possible to compile wheels for Windows? I see that the Windows support was added in #9 so I assume it's just a matter of building the wheels locally or in CI.

Decimal support?

It can sometimes be useful to parse numbers as Decimals, e.g. when working with DynamoDB and various other boto3 APIs.

There doesn't seem to be any way to do this during parsing, and doing it after a decode pass can result in lossy behavior that some APIs (such as boto3) don't like.

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.