Releases: fenhl/lazyjson
lazyjson 2.2.0 — better iteration and support for open kwargs
The __iter__
method on Node
s (which is used e.g. in for
loops) is now a part of the API, and has been customized to always yield more nodes. Iterating over nodes representing objects yields the values.
file_is_open
, an optional argument to the File
constructor, is now documented and versioned.
As a new feature, the File
constructor now also takes arbitrary keyword arguments and passes them to each call to open
. This can for example be used to open a file with a certain encoding.
lazyjson 2.1.0 — get
With this release, the get
method on nodes is overridden to handle key lookup correctly and to always return Python values (as opposed to nodes). It also accepts numeric indices and slice objects as its first arguments when used on arrays.
lazyjson 2.0.1
This release fixes missing imports that caused parse_version_string
to fail.
lazyjson 2.0.0 — ABC
With this backwards-incompatible release, lazyjson now supports files which have values other than objects as their root node. To support this, the Dict
and List
subclasses are gone, and a Node
may now represent a JSON value of any type.
Also, File
now inherits from an ABC called BaseFile
. Implementing lazyjson files with custom behaviors is easy; just implement value
(reading) and set
(writing).
New types of files come with lazyjson now:
SFTPFile
, which represents a file on the network, accessed through SFTP (requires paramiko),MultiFile
, which represents a stack of files, recursively merged into one upon reading (writing doesn't quite work as expected yet),- and
PythonFile
, which just stores data in a native Python object (and can be used in multifiles as fallback).
lazyjson 1.2.0 — file object support and write failsafe
With this release, lazyjson.File
objects support open file objects as constructor arguments in addition to objects that can be open
ed and pathlib.Path
objects.
There is also a new failsafe that will cause lazyjson to raise an exception before trying to write an object that contains illegal elements, instead of letting json
start to write to the file and then leaving corrupted JSON behind when it encounters the illegal object. This failsafe works by simply passing the object to json.dumps
, which should raise an exception if it cannot be converted to valid JSON.
lazyjson 1.1.0 — pathlib support
With this release, lazyjson.File
objects support pathlib.Path
objects as constructor arguments in addition to objects that can be open
ed.
lazyjson
still maintains backward compatibility with Python 3.2 and 3.3.
lazyjson 1.0.2 — Python 3.2 compatibility
With this release, lazyjson is designed to work not only for Python version 3.3 but also version 3.2.
lazyjson 1.0.1 — Make everything work
With this release, everything should work as intended. The examples in the readme have been tested. Lazyjson will also make sure that changed files end in a newline.