Package: python-rapidjson
Authors:Ken Robbins <ken@kenrobbins.com>Lele Gaifax <lele@metapensiero.it>License:MIT LicenseStatus:RapidJSONis an extremely fast C++ JSON parser and serialization library: this module
wraps it into a Python 3 extension, exposing its serialization/deserialization (to/from
eitherbytes,strorfile-likeinstances) andJSON Schemavalidation
capabilities.Latest version documentation is automatically rendered byRead the Docs.Getting StartedFirst installpython-rapidjson:$pipinstallpython-rapidjsonor, if you preferConda:$condainstall-cconda-forgepython-rapidjsonBasic usage looks like this:>>>importrapidjson>>>data={'foo':100,'bar':'baz'}>>>rapidjson.dumps(data)'{"foo":100,"bar":"baz"}'>>>rapidjson.loads('{"bar":"baz","foo":100}'){'bar':'baz','foo':100}>>>>>>classStream:...defwrite(self,data):...print("Chunk:",data)...>>>rapidjson.dump(data,Stream(),chunk_size=5)Chunk:b'{"foo'Chunk:b'":100'Chunk:b',"bar'Chunk:b'":"ba'Chunk:b'z"}'DevelopmentIf you want to install the development version (maybe to contribute fixes or
enhancements) you may clone the repository:$gitclone--recursivehttps://github.com/python-rapidjson/python-rapidjson.gitNoteThe--recursiveoption is needed because we use asubmoduleto
includeRapidJSONsources. Alternatively you can do a plaincloneimmediately followed by agit submodule update--init.Alternatively, if you already have (acompatibleversion of)
RapidJSON includes around, you can compile the module specifying
their location with the option--rj-include-dir, for example:$python3setup.pybuild--rj-include-dir=/usr/include/rapidjsonA set of makefiles implement most common operations, such asbuild,checkandrelease; seemake helpoutput for a list of available targets.Performancepython-rapidjsontries to be as performant as possible while staying
compatible with thejsonmodule.See thethis sectionin the documentation for a comparison with other JSON libraries.IncompatibilityAlthough we tried to implement an API similar to the standard libraryjson, being a
strictdrop-inreplacement in not our goal and we have decided to depart from there in
some aspects. Seethis sectionin the documentation for further details.Changes1.16 (2024-02-28)Produce Python 3.8 wheels again, I deactivated it too eagerly, it’s insecurity fixes
onlymode, not yet reached itsend-of-lifestate1.15 (2024-02-28)Honor therecursion limitalso at parse time, to avoid attacks as described byCVE-2024-274541.14 (2023-12-14)Produce binary wheels for macOS/arm64, thanks to timothyjlaurent (PR #195)1.13 (2023-10-29)Fix handling of write_mode in dump functions (problem emerged discussingissue #191)1.12 (2023-10-07)Generate wheels on PyPI using final Python 3.12 release, thanks to cibuildwheel2.16.21.11 (2023-09-11)Usecurrent masterversion of rapidjsonUse cibuildwheel2.15.01.10 (2023-03-15)Usecurrent masterversion of rapidjsonProduce ppc64le wheels, thanks to mgiessing (PR #170)Use cibuildwheel2.12.11.9 (2022-10-17)Produce Python 3.11 wheels, thanks tocibuildwheel2.11.11.8 (2022-07-07)Fixproblem on macOSexplicitly requiring C++11, thanks to agate-pris (issue
#166)1.7 (2022-07-06)Usecurrent masterversion of rapidjsonUpdate the test suite to work on Pyston, thanks to Kevin Modzelewski (PR #161)1.6 (2022-02-19)Fix memory leak when usingend_array(issue #160)1.5 (2021-10-16)Fix serialization bug when using DM_UNIX_TIME in a non-C locale context1.4 (2021-06-25)Build binary wheel for aarch64, thanks to odidev (PR #156)1.3 (2021-06-25)Yet another attempt to fix automatic wheels upload1.2 (2021-06-25)Fix automatic wheels upload from GH Actions to PyPI1.1 (2021-06-25)Reduce decoder memory consumption by uniquifiying keys in the loaded dictionariesImplement an alternative way of transmogrify JSON objects, similar tojson‘sobject_pairs_hookload option (issue #154)1.0 (2020-12-13)Require Python 3.6 or greaterNew serialization options,iterable_modeandmapping_mode, to give some control
on how generic iterables and mappings get encoded (fixissue #149andissue #150)Internal refactorings, folding “skipkeys” and “sort_keys” arguments into the
mapping_mode options, respectively as MM_SKIP_NON_STRING_KEYS and MM_SORT_KEYS: “old”
arguments kept for backward compatibilityBump major version to 1, tag as “production/stable” and switch to a simpler X.Y
versioning schema0.9.4 (2020-11-16)Fix memory leak loading an invalid JSON (issue #148)0.9.3 (2020-10-24)Fix access toEncoderinstance attributes (issue #147)0.9.2 (2020-10-24)Usecurrent masterversion of rapidjsonEnable GH Actions-based test workflow, thanks to Martin Thoma (PR #143)Produce Python 3.9 wheels, disable testing under Python < 3.6Make the character used for indentation in pretty mode a parameter (issue #135)Handle wider precision range in timestamps fractional seconds (PR 133), thanks to
Karl SeguinAdd comparison benchmarks against orjson and hyperjson (issue #130andPR #131,
thanks to Sebastian Pipping)0.9.1 (2019-11-13)Fix memory leak in case of failed validation (issue #126)0.9.0 (2019-11-13)Produce Python 3.8 wheelsCompatibility fix for Python 3.8 (issue #125)New dump optionwrite_mode, supporting RapidJSON’skFormatSingleLineArrayoption
(issue #123), thanks to Nguyễn Hồng Quân for the initial implementation (PR #124)0.8.0 (2019-08-09)New serialization optionbytes_modeto control how bytes instances get encoded
(issue #122)0.7.2 (2019-06-09)Hopefully fix the memory leak when loading from a stream (issue #117)0.7.1 (2019-05-11)Raise a more specific exception on loading errors,JSONDecodeError, instead of
genericValueError(issue #118)Fix optimization path when usingOrderedDicts (issue #119)Fix serialization ofIntEnums (issue #121)I spentquite a lotof time investigating on the memory leak when loading from a
stream (issue #117): as I was not able to fully replicate the problem, I cannot be
sure I solved the problem… sorry!0.7.0 (2019-02-11)Raise correct exception in code samples (PR #109), thanks to Thomas DählingFix compilation with system-wide install of rapidjson (issue #110)Use current master version of rapidjson, that includes afixfor itsissue #1368andissue #1336, and cures several compilation warnings as well (issue #112andissue #107)Fix memory leak when usingobject_hook(issue #115)0.6.3 (2018-07-11)No visible changes, but now PyPI carries binary wheels for Python 3.7.0.6.2 (2018-06-08)Use a more specific ValidationError, to differentiate from invalid JSON0.6.1 (2018-06-06)Nothing new, attempt to build Python 3.6 binary wheels on Travis CI0.6.0 (2018-06-06)Add a new comparison table involvingensure_ascii(issue #98)Use Python’srepr()to emit float values instead of rapidjson’sdtoa()(issue
#101)Use a newer (although unreleased) version of rapidjson to fix anissuewith
JSONSchema validation (PR #103), thanks to Anthony Miyaguchi0.5.2 (2018-03-31)Tiny tweak to restore macOS build on Travis CI0.5.1 (2018-03-31)Minor tweaks to CI and PyPI deploy configuration0.5.0 (2018-03-31)NewRawJSONclass, allowing inclusion ofpre-serializedcontent (PR #95andPR #96), thanks to Silvio Tomatis0.4.3 (2018-01-14)Deserialize frombytesandbytearrayinstances, ensuring they
contain valid UTF-8 dataSpeed up parsing of floating point numbers, avoiding intermediary conversion
to a Python string (PR #94)0.4.2 (2018-01-09)Fix precision handling of DM_UNIX_TIME timestamps0.4.1 (2018-01-08)Fix memory leaks inDecoder()andEncoder()classes, related to
bad handling ofPyObject_GetAttr()result valueFix compatibility with Python 3.7a0.4.0 (2018-01-05)Implemented the streaming interface, seeload()anddump()(issue #80)Backward incompatibility: now theflagsarguments on all the functions arekeyword only, to mimic stdlib’sjsonstyle0.3.2 (2017-12-21)Reduce compiler warnings (issue #87)0.3.1 (2017-12-20)Fix Travis CI recipe to accomodate MacOS0.3.0 (2017-12-20)Fix compilation on MacOS (issue #78)Handle generic iterables (PR #89)Backward incompatibility: thedumps()function and theEncoder()constructor used to accept amax_recursion_depthargument, to control
the maximum allowed nesting of Python structures; since the underlying
function is now effectively recursive, it has been replaced by the genericsys.setrecursionlimit()mechanism0.2.7 (2017-12-08)Restore compatibility with Python < 3.60.2.6 (2017-12-08)Fix memory leaks when using object_hook/start_object/end_object0.2.5 (2017-09-30)Fix bug where error handling code could raise an exception causing a
confusing exception to be returned (PR #82)Fix bug where loads’sobject_hookand dumps’sdefaultarguments
could not be passedNoneexplicitly (PR #83)Fix crash when dealing with surrogate pairs (issue #81)0.2.4 (2017-09-17)Fix compatibility with MacOS/clang0.2.3 (2017-08-24)Limit the precision of DM_UNIX_TIME timestamps to six decimal digits0.2.2 (2017-08-24)Nothing new, attempt to fix production of Python 3.6 binary wheels0.2.1 (2017-08-24)Nothing new, attempt to fix production of Python 3.6 binary wheels0.2.0 (2017-08-24)Newparse_modeoption, implementing relaxed JSON syntax (issue #73)NewEncoderandDecoder, implementing a class-based interfaceNewValidator, exposing the underlyingJSON schemavalidation (issue #71)0.1.0 (2017-08-16)Remove beta status0.1.0b4 (2017-08-14)Make execution of the test suite on Appveyor actually happen0.1.0b3 (2017-08-12)Exclude CI configurations from the source distribution0.1.0b2 (2017-08-12)Fix Powershell wheel upload script in appveyor configuration0.1.0b1 (2017-08-12)Compilable with somewhat old g++ (issue #69)Backward incompatibilities:allDATETIME_MODE_XXXconstants have been shortened toDM_XXXDATETIME_MODE_ISO8601_UTChas been renamed toDM_SHIFT_TO_UTCallUUID_MODE_XXXconstants have been shortened toUM_XXXNew optionDM_UNIX_TIMEto serialize date, datetime and time values asUNIX timestampstargetingissue #61New optionDM_NAIVE_IS_UTCto treat naïve datetime and time values as if
they were in the UTC timezone (also for issue #61)New keyword argumentnumber_modeto use underlying C library numbersBinary wheels for GNU/Linux and Windows on PyPI (one would hope: this is the
reason for the beta1 release)0.0.11 (2017-03-05)Fix a couple of refcount handling glitches, hopefully targetingissue
#48.0.0.10 (2017-03-02)Fix source distribution to contain all required stuff (PR #64)0.0.9 (2017-03-02)CI testing on GitHubAllow using locally installed RapidJSON library (issue #60)Bug fixes (issue #37,issue #51,issue #57)0.0.8 (2016-12-09)Use unpatched RapidJSON 1.1 (PR #46)Handle serialization and deserialization of datetime, date and time
instances (PR #35) and of UUID instances (PR #40)Sphinx based documentation (PR #44)Refresh benchmarks (PR #45)Bug fixes (issue #25,issue #38,PR #43)