Debian Codegraph @

CHANGES.rst

raw
1 v4.0.2
2 ======
3 * The unpickler is now more resilient to malformed "py/id" and "py/repr" data.
4 (+546)
5 * The unpickler is now more resilient to invalid "py/b85" and "py/b64" data.
6 (+547)
7 * The unpickler's support for read-only str attributes was improved.
8 (+548) (#478)
9
10 v4.0.1
11 ======
12 * The unpickler is now more resilient to malformed "py/reduce", "py/set",
13 "py/tuple", "py/b64", "py/b85", and "py/iterator" input data. (+544) (+545)
14 * The test suite was updated to leverage more pytest features.
15 * The ``jsonpickle.compat`` module is no longer used. It is still provided
16 for backwards compatibility but it may be removed in a future version.
17
18 v4.0.0
19 ======
20 * **Breaking Change**: Python 3.7 is no longer supported.
21 * **Breaking Change**: Support for pre-0.7.0 ``repr``-serialized objects is no
22 longer enabled by default. The ``safe`` option to ``decode()`` was changed from
23 ``False`` to ``True``. Users can still pass ``safe=False`` to ``decode()`` in order
24 to enable this feature for the purposes of loading older files, but beware that
25 this feature relies on unsafe behavior through its use of ``eval()``. Users are
26 encouraged to re-pickle old data in order to migrate away from the the unsafe loading
27 feature. (+514)
28 * The pickler no longer produces ``py/repr`` tags when pickling modules.
29 ``py/mod`` is used instead, as it is clearer and uses one less byte. (+514)
30 * The test suite no longer uses the deprecated ``datetime.datetime.utcnow()``
31 function. (+539)
32
33 v3.4.2
34 ======
35 * The breaking changes from v4 were inadvertedly included in v3.4.1, which has
36 been yanked. This release remedies this by reverting the v4 changes.
37
38 v3.4.1
39 ======
40 * Support decoding pandas dataframes encoded with versions 3.3.0 and older. (+536)
41
42 v3.4.0
43 ======
44 * Officially support Python 3.12 in the GitHub Actions testing matrix, and update
45 GHA package versions used. (+524)
46 * Improve reproducibility of benchmarking commands on Linux by using taskset and
47 adding a "HOWTO" run benchmarks section in ``benchmarking/README.md``. (+526)
48 * The ``setup.cfg`` packaging configuration has been replaced by
49 ``pyproject.toml``. (+527)
50 * ``yaml`` is now supported as a jsonpickle backend. (+528)
51 * `OSSFuzz <https://github.com/google/oss-fuzz>`_ scripts are now available in
52 the ``fuzzing/`` directory. (+525)
53 * Pure-python dtypes are now preserved across ``encode()``/``decode()`` roundtrips
54 for the pandas extension. (#407) (+534)
55 * Pandas dataframe columns with an ``object`` dtype that contain multiple different
56 types within (e.g. a column of type ``list[Union[str, int]]``) now preserve the types
57 upon being roundtripped. (#457) (#358) (+534)
58 * Fix warnings in the test suite regarding numpy.compat usage. (#533) (+535)
59
60 v3.3.0
61 ======
62 * The unpickler was updated to avoid using ``eval``, which helps improve its
63 security. Users can still pass ``safe=False`` to ``decode`` to use the old
64 behavior, though this is not recommended. (+513)
65 * Objects can now exclude specific attributes from pickling by providing a
66 ``_jsonpickle_exclude`` class or instance attribute. This attribute should contain
67 the list of attribute names to exclude when pickling the object.
68
69 v3.2.2
70 ======
71 * A bug with the incorrect (de)serialization of NoneType objects has been fixed.
72 (+507)
73 * ``tests/benchmark.py`` was updated to avoid Python 2 syntax. (+508)
74 * The unpickler was updated to avoid creating temporary functions. (+508)
75 * Some basic scripts have been made to analyze benchmark results. (+511)
76 * Fix test suite compatibility with Numpy 2.x (+512)
77 * `setup.cfg` was updated to use `license_files` instead of `license_file`.
78
79 v3.2.1
80 ======
81 * The ``ignorereserved`` parameter to the private ``_restore_from_dict()``
82 function has been restored for backwards compatibility. (+501)
83
84 v3.2.0
85 ======
86 * Nested dictionaries in `py/state` are now correctly restored when
87 tracking object references. (+501) (#500)
88
89 v3.1.0
90 ======
91 * `jsonpickle.ext.numpy.register_handlers` now provides options that are forwarded
92 to the `NumpyNDArrayHandler` constructor. (+489)
93 * Fix bug of not handling ``classes`` argument to `jsonpickle.decode`
94 being a dict. Previously, the keys were ignored and only values were
95 used. (+494)
96 * Allow the ``classes`` argument to `jsonpickle.pickle` to have class
97 objects as keys. This extends the current functionality of only having
98 class name strings as keys. (+494)
99 * The ``garden setup/dev`` action and ``requirements-dev.txt`` requirements file
100 now include test dependencies for use during development.
101 * Added support for Python 3.13. (+505) (#504)
102
103 v3.0.4
104 ======
105 * Fixed an issue with django.SafeString and other classes inheriting from
106 str having read-only attribute errors (#478) (+481)
107 * The test suite was made compatible with `pytest-ruff>=0.3.0`. (+482)
108 * A `garden.yaml` file was added for use with the
109 `garden <https://crates.io/crates/garden-tools>_` command runner. (+486)
110 * The test suite was updated to avoid deprecated SQLALchemy APIs.
111 * The `jaraco.packaging.sphinx` documentation dependency was removed.
112
113 v3.0.3
114 ======
115 * Compatibilty with Pandas and Cython 3.0 was added. (#460) (+477)
116 * Fixed a bug where pickling some built-in classes (e.g. zoneinfo)
117 could return a ``None`` module. (#447)
118 * Fixed a bug where unpickling a missing class would return a different object
119 instead of ``None``. (+471)
120 * Fixed the handling of missing classes when setting ``on_missing`` to ``warn``
121 or ``error``. (+471)
122 * The test suite was made compatible with Python 3.12.
123 * The tox configuration was updated to generate code coverage reports.
124 * The suite now uses ``ruff`` to validate python code.
125 * The documentation can now be built offline when ``rst.linker`` and
126 ``jaraco.packaging.sphinx`` are not available.
127
128 v3.0.2
129 ======
130 * Properly raise warning if a custom pickling handler returns None. (#433)
131 * Fix issue with serialization of certain sklearn objects breaking when
132 the numpy handler was enabled. (#431) (+434)
133 * Allow custom backends to not implement _encoder_options (#436) (+446)
134 * Implement compatibility with pandas 2 (+446)
135 * Fix encoding/decoding of dictionary subclasses with referencing (+455)
136 * Fix depth tracking for list/dict referencing (+456)
137
138 v3.0.1
139 ======
140 * Remove accidental pin of setuptools to versions below 59. This allows
141 jsonpickle to build with CPython 3.11 and 3.12 alphas. (#424)
142 * Remove accidental dependency on pytz in pandas tests. (+421)
143 * Fix issue with decoding bson.bson.Int64 objects (#422)
144
145 v3.0.0
146 ======
147 * Drop support for CPython<3.7. CPython 3.6 and below have reached EOL
148 and no longer receive security updates. (#375)
149 * Add support for CPython 3.11. (#395) (+396)
150 * Remove jsonlib and yajl backends (py2 only)
151 * Add ``include_properties`` option to the pickler. This should only
152 be used if analyzing generated json outside of Python. (#297) (+387)
153 * Allow the ``classes`` argument to ``jsonpickle.decode`` to be a dict
154 of class name to class object. This lets you decode arbitrary dumps
155 into different classes. (#148) (+392)
156 * Fix bug with deserializing `numpy.poly1d`. (#391)
157 * Allow frozen dataclasses to be deserialized. (#240)
158 * Fixed a bug where pickling a function could return a ``None`` module. (#399)
159 * Removed old bytes/quopri and ref decoding abaility from the unpickler.
160 These were last used in jsonpickle<1. Removing them causes a slight speedup
161 in unpickling lists (~5%). (+403)
162 * Fixed a bug with namedtuples encoding on CPython 3.11. (#411)
163 * When using the ``sort_keys`` option for the ``simplejson`` backend,
164 jsonpickle now produces correct object references with py/id tags. (#408)
165 * Speed up the internal method ``_restore_tags`` by ~10%. This should speed
166 up unpickling of almost every object.
167
168 v2.2.0
169 ======
170
171 * Classes with a custom ``__getitem__()`` and ``append()``
172 now pickle properly. (#362) (+379)
173 * Remove the demjson backend, as demjson hasn't been maintained
174 for 5 years. (+379)
175 * Added new handler for numpy objects when using unpickleable=False.
176 (#381) (+382)
177 * Added exception handling for class attributes that can't be accessed.
178 (#301) (+383)
179 * Added a long-requested on_missing attribute to the Unpickler class.
180 This lets you choose behavior for when jsonpickle can't find a class
181 to deserialize to. (#190) (#193) (+384)
182 * Private members of ``__slots__`` are no longer skipped when encoding.
183 Any objects encoded with versions prior to 2.2.0 should still decode
184 properly. (#318) (+385)
185
186 v2.1.0
187 ======
188
189 * Python 3.10 is now officially supported. (+376)
190 * Benchmarks were added to aid in optimization efforts. (#350) (+352)
191 * ``is_reducible()`` was sped up by ~80%. (+353) (+354)
192 * ``_restore_tags()`` was sped up by ~100%. Unpickling items
193 with a lot of tuples and sets will benefit most. Python 2 users
194 and users deserializing pickles from jsonpickle <= 0.9.6 may see
195 a slight performance decrease if using a lot of bytes, ref,
196 and/or repr objects. (+354)
197 * ``is_iterator()`` was sped up by ~20% by removing an unnecessary
198 variable assignment. (+354)
199 * ``jsonpickle.decode`` has a new option, ``v1_decode`` to assist in
200 decoding objects created in jsonpickle version 1. (#364)
201 * The ``encode()`` documentation has been updated to help sklearn users.
202 * ``demjson`` has been removed from the test suite. (+374)
203 * ``SQLALchemy<1.2`` is no longer being tested by jsonpickle.
204 Users of sqlalchemy + jsonpickle can always use 1.2 or 1.3.
205 When jsonpickle v3 is released we will add SQLAlchemy 1.4 to
206 the test suite alongside removal of support for Python 3.5 and earlier.
207
208 v2.0.0
209 ======
210 * Major release: the serialized JSON format now preserves dictionary
211 identity, which is a subtle change in the serialized format. (#351)
212 * Dictionary identity is now preserved. For example, if the same
213 dictionary appears twice in a list, the reconstituted list
214 will now contain two references to the same dictionary. (#255) (+332)
215
216 v1.5.2
217 ======
218 * Patch release to avoid the change in behavior from the preservation
219 of dict identity. The next release will be v2.0.0. (#351)
220 * This release does *not* include the performance improvements
221 from v1.5.1.
222 * Pandas DataFrame objects with multilevel columns are now supported.
223 (#346) (+347)
224 * Numpy 1.20 is now officially supported. (#336)
225 * Python 3.9 is now officially supported. (+348)
226 * Achieved a small speedup for _get_flattener by merging type checks. (+349)
227
228 v1.5.1
229 ======
230 * The performance of the unpickler was drastically improved by
231 avoiding tag checks for basic Python types. (+340)
232 * ``decode()`` documentation improvements. (+341)
233 * Serialization of Pandas DataFrame objects that contain
234 timedelta64[ns] dtypes are now supported. (+330) (#331)
235 * Dictionary identity is now preserved. For example, if the same
236 dictionary appears twice in a list, the reconstituted list
237 will now contain two references to the same dictionary. (#255) (+332)
238 * Unit tests were added to ensure that sklearn.tree.DecisionTreeClassifier
239 objects are properly serialized. (#155) (+344)
240 * The ``is_reducible()`` utility function used by ``encode()`` is now
241 4x faster! Objects that provide ``__getstate__()``, ``__setstate__()``,
242 and ``__slots__`` benefit most from these improvements. (+343)
243 * Improved pickler ``flatten()/encode()`` performance. (+345)
244
245 v1.5.0
246 ======
247 * Previous versions of jsonpickle with `make_refs=False` would emit
248 ``null`` when encountering an object it had already seen when
249 traversing objects. All instances of the object are now serialized.
250 While this is arguably an improvement in the vast majority of
251 scenarios, it is a change in behavior and is thus considered a
252 minor-level change. (#333) (#334) (#337) (+338)
253 * Multiple enums are now serialized correctly with `make_refs=False`. (#235)
254
255 v1.4.2
256 ======
257 * Use importlib.metadata from the stdlib on Python 3.8. (+305) (#303)
258 * Micro-optimize type checks to use a `set` for lookups. (+327)
259 * Documentation improvements.
260
261 v1.4.1
262 ======
263 * Patch release for Python 3.8 `importlib_metadata` support.
264 (#300)
265
266 v1.4
267 ====
268 * Python 3.8 support. (#292)
269 * ``jsonpickle.encode`` now supports the standard ``indent``
270 and ``separators`` arguments, and passes them through to the
271 active JSON backend library. (#183)
272 * We now include a custom handler for `array.array` objects. (#199)
273 * Dict key order is preserved when pickling dictionaries on Python3. (#193)
274 * Improved serialization of dictionaries with non-string keys.
275 Previously, using an enum that was both the key and a value in
276 a dictionary could end up with incorrect references to other
277 objects. The references are now properly maintained for dicts
278 with object keys that are also referenced in the dict's values. (#286)
279 * Improved serialization of pandas.Series objects. (#287)
280
281 v1.3
282 ====
283 * Improved round tripping of default dicts. (+283) (#282)
284
285 * Better support for cyclical references when encoding with
286 ``unpicklable=False``. (+264)
287
288 v1.2
289 ====
290 * Simplified JSON representation for `__reduce__` values. (+261)
291
292 * Improved Pandas support with new handlers for more Pandas data types.
293 (+256)
294
295 * Prevent stack overflows caused by bugs in user-defined `__getstate__`
296 functions which cause infinite recursion. (+260)
297 (#259)
298
299 * Improved support for objects that contain dicts with Integer keys.
300 Previously, jsonpickle could not restore objects that contained
301 dicts with integer keys and provided getstate only.
302 These objects are now handled robustly. (#247).
303
304 * Support for encoding binary data in `base85`_ instead of base64 has been
305 added on Python 3. Base85 produces payloads about 10% smaller than base64,
306 albeit at the cost of lower throughput. For performance and backwards
307 compatibility with Python 2 the pickler uses base64 by default, but it can
308 be configured to use ``base85`` with the new ``use_base85`` argument.
309 (#251).
310
311 * Dynamic SQLAlchemy tables in SQLAlchemy >= 1.3 are now supported.
312 (#254).
313
314 .. _base85: https://en.wikipedia.org/wiki/Ascii85
315
316
317 v1.1
318 ====
319 * Python 3.7 `collections.Iterator` deprecation warnings have been fixed.
320 (#229).
321
322 * Improved Pandas support for datetime and complex numbers. (+245)
323
324 v1.0
325 ====
326 * *NOTE* jsonpickle no longer supports Python2.6, or Python3 < 3.4.
327 The officially supported Python versions are now 2.7 and 3.4+.
328
329 * Improved Pandas and Numpy support. (+227)
330
331 * Improved support for pickling iterators. (+216)
332
333 * Better support for the stdlib `json` module when `simplejson`
334 is not installed. (+217)
335
336 * jsonpickle will now output python3-style module names when
337 pickling builtins methods or functions. (+223)
338
339 * jsonpickle will always flatten primitives, even when ``max_depth``
340 is reached, which avoids encoding unicode strings into their
341 ``u'string'`` representation. (+207) (#180) (#198).
342
343 * Nested classes are now supported on Python 3. (+206) (#176).
344
345 * Better support for older (pre-1.9) versions of numpy (+195).
346
347 v0.9.6
348 ======
349 * Better support for SQLAlchemy (#180).
350
351 * Better support for NumPy and SciKit-Learn. (#184).
352
353 * Better support for dict sub-classes (#156).
354
355 v0.9.5
356 ======
357 * Better support for objects that implement the reduce protocol. (+170)
358 This backward-incompatible change removes the SimpleReduceHandler.
359 Any projects registering that handler for a particular type should
360 instead remove references to the handler and jsonpickle will now
361 handle those types directly.
362
363 v0.9.4
364 ======
365 * Arbitrary byte streams are now better supported. (#143)
366
367 * Better support for NumPy data types. The Python3 NumPy support
368 is especially robust.
369
370 * Fortran-ordered based NumPy arrays are now properly serialized.
371
372 v0.9.3
373 ======
374 * UUID objects can now be serialized (#130)
375
376 * Added `set_decoder_options` method to allow decoder specific options
377 equal to `set_encoder_options`.
378
379 * Int keys can be encoded directly by e.g. demjson by passing
380 `numeric_keys=True` and setting its backend options via
381 `jsonpickle.set_encoder_options('demjson', strict=False)`.
382
383 * Newer Numpy versions (v1.10+) are now supported.
384
385 v0.9.2
386 ======
387 * Fixes for serializing objects with custom handlers.
388
389 * We now properly serialize deque objects constructed with a `maxlen` parameter.
390
391 * Test suite fixes
392
393 v0.9.1
394 ======
395
396 * Support datetime objects with FixedOffsets.
397
398 v0.9.0
399 ======
400 * Support for Pickle Protocol v4.
401
402 * We now support serializing defaultdict subclasses that use `self`
403 as their default factory.
404
405 * We now have a decorator syntax for registering custom handlers,
406 and allow custom handlers to register themselves for all subclasses.
407 (+104)
408
409 * We now support serializing types with metaclasses and their
410 instances (e.g., Python 3 `enum`).
411
412 * We now support serializing bytestrings in both Python 2 and Python 3.
413 In Python 2, the `str` type is decoded to UTF-8 whenever possible and
414 serialized as a true bytestring elsewise; in Python 3, bytestrings
415 are explicitly encoded/decoded as bytestrings. Unicode strings are
416 always encoded as is in both Python 2 and Python 3.
417
418 * Added support for serializing numpy arrays, dtypes and scalars
419 (see `jsonpickle.ext.numpy` module).
420
421 v0.8.0
422 ======
423
424 * We now support serializing objects that contain references to
425 module-level functions. (#77)
426
427 * Better Pickle Protocol v2 support. (#78)
428
429 * Support for string ``__slots__`` and iterable ``__slots__``. (#67) (#68)
430
431 * `encode()` now has a `warn` option that makes jsonpickle emit warnings
432 when encountering objects that cannot be pickled.
433
434 * A Javascript implementation of jsonpickle is now included
435 in the jsonpickleJS directory.
436
437 v0.7.2
438 ======
439
440 * We now properly serialize classes that inherit from classes
441 that use `__slots__` and add additional slots in the derived class.
442 * jsonpickle can now serialize objects that implement `__getstate__()` but
443 not `__setstate__()`. The result of `__getstate__()` is returned as-is
444 when doing a round-trip from Python objects to jsonpickle and back.
445 * Better support for collections.defaultdict with custom factories.
446 * Added support for `queue.Queue` objects.
447
448 v0.7.1
449 ======
450
451 * Added support for Python 3.4.
452 * Added support for `posix.stat_result`.
453
454 v0.7.0
455 ======
456
457 * Added ``handles`` decorator to :class:`jsonpickle.handlers.BaseHandler`,
458 enabling simple declaration of a handler for a class.
459 * `__getstate__()` and `__setstate__()` are now honored
460 when pickling objects that subclass :class:`dict`.
461 * jsonpickle can now serialize :class:`collections.Counter` objects.
462 * Object references are properly handled when using integer keys.
463 * Object references are now supported when using custom handlers.
464 * Decimal objects are supported in Python 3.
465 * jsonpickle's "fallthrough-on-error" behavior can now be disabled.
466 * Simpler API for registering custom handlers.
467 * A new "safe-mode" is provided which avoids eval().
468 Backwards-compatible deserialization of repr-serialized objects
469 is disabled in this mode. e.g. `decode(string, safe=True)`
470
471 v0.6.1
472 ======
473
474 * Python 3.2 support, and additional fixes for Python 3.
475
476 v0.6.0
477 ======
478
479 * Python 3 support!
480 * :class:`time.struct_time` is now serialized using the built-in
481 `jsonpickle.handlers.SimpleReduceHandler`.
482
483 v0.5.0
484 ======
485
486 * Non-string dictionary keys (e.g. ints, objects) are now supported
487 by passing `keys=True` to :func:`jsonpickle.encode` and
488 :func:`jsonpickle.decode`.
489 * We now support namedtuple, deque, and defaultdict.
490 * Datetimes with timezones are now fully supported.
491 * Better support for complicated structures e.g.
492 datetime inside dicts.
493 * jsonpickle added support for references and cyclical data structures
494 in 0.4.0. This can be disabled by passing `make_refs=False` to
495 :func:`jsonpickle.encode`.
496
497 0.4.0
498 =====
499
500 * Switch build from setuptools to distutils
501 * Consistent dictionary key ordering
502 * Fix areas with improper support for unpicklable=False
503 * Added support for cyclical data structures
504 (#16).
505 * Experimental support for `jsonlib <http://pypi.python.org/pypi/jsonlib/>`_
506 and `py-yajl <http://github.com/rtyler/py-yajl/>`_ backends.
507 * New contributors David K. Hess and Alec Thomas
508
509 .. warning::
510
511 To support cyclical data structures
512 (#16),
513 the storage format has been modified. Efforts have been made to
514 ensure backwards-compatibility. jsonpickle 0.4.0 can read data
515 encoded by jsonpickle 0.3.1, but earlier versions of jsonpickle may be
516 unable to read data encoded by jsonpickle 0.4.0.
517
518
519 0.3.1
520 =====
521
522 * Include tests and docs directories in sdist for distribution packages.
523
524 0.3.0
525 =====
526
527 * Officially migrated to git from subversion. Project home now at
528 `<http://jsonpickle.github.com/>`_. Thanks to Michael Jone's
529 `sphinx-to-github <http://github.com/michaeljones/sphinx-to-github>`_.
530 * Fortified jsonpickle against common error conditions.
531 * Added support for:
532
533 * List and set subclasses.
534 * Objects with module references.
535 * Newstyle classes with `__slots__`.
536 * Objects implementing `__setstate__()` and `__getstate__()`
537 (follows the :mod:`pickle` protocol).
538
539 * Improved support for Zope objects via pre-fetch.
540 * Support for user-defined serialization handlers via the
541 jsonpickle.handlers registry.
542 * Removed cjson support per John Millikin's recommendation.
543 * General improvements to style, including :pep:`257` compliance and
544 refactored project layout.
545 * Steps towards Python 2.3 and Python 3 support.
546 * New contributors Dan Buch and Ian Schenck.
547 * Thanks also to Kieran Darcy, Eoghan Murray, and Antonin Hildebrand
548 for their assistance!
549
550 0.2.0
551 =====
552
553 * Support for all major Python JSON backends (including json in Python 2.6,
554 simplejson, cjson, and demjson)
555 * Handle several datetime objects using the repr() of the objects
556 (Thanks to Antonin Hildebrand).
557 * Sphinx documentation
558 * Added support for recursive data structures
559 * Unicode dict-keys support
560 * Support for Google App Engine and Django
561 * Tons of additional testing and bug reports (Antonin Hildebrand, Sorin,
562 Roberto Saccon, Faber Fedor,
563 `FirePython <http://github.com/darwin/firepython/tree/master>`_, and
564 `Joose <http://code.google.com/p/joose-js/>`_)
565
566 0.1.0
567 =====
568
569 * Added long as basic primitive (thanks Adam Fisk)
570 * Prefer python-cjson to simplejson, if available
571 * Major API change, use python-cjson's decode/encode instead of
572 simplejson's load/loads/dump/dumps
573 * Added benchmark.py to compare simplejson and python-cjson
574
575 0.0.5
576 =====
577
578 * Changed prefix of special fields to conform with CouchDB
579 requirements (Thanks Dean Landolt). Break backwards compatibility.
580 * Moved to Google Code subversion
581 * Fixed unit test imports
582
583 0.0.3
584 =====
585
586 * Convert back to setup.py from pavement.py (issue found by spidaman)
587
588 0.0.2
589 =====
590
591 * Handle feedparser's FeedParserDict
592 * Converted project to Paver
593 * Restructured directories
594 * Increase test coverage
595
596 0.0.1
597 =====
598
599 Initial release