Tools to read and write .son files
Project description
son | sequential object notation
What is this?
son is a data format that builds on JSON and adds one
feature inspired by YAML: concatenation of objects with
---
. Optionally, the delimiter ===
can be used once per son file to delimit
metadata.
Why son?
While JSON is perfect for storing structured data, it is inherently impossible
to add new portions of data to a file without reading it first. YAML files on
the other hand are self extensible by the ---
delimiter, but the flexibility
YAML offers makes the files inefficient to parse. They are thus unsuited to
store significant amounts of data.
son fills the gap by allowing JSON objects to be concatenated with ---
. It
thus combines the speed and efficiency of JSON with the sequential extensibility
of YAML, see example. It further adds to discern metadata from
actual data by using ===
.
son does not allow to overwrite data. In order to avoid accidental data loss, metada can only be written to fresh files, whereas data can only be appended to files.
Who needs this?
son originated from the need to store computational data that is produced portion by portion on a computer. The requirements were:
- Possible to be read by a human,
- possible to store arbitrary data structures including metadata,
- easy to write and parse by a computer,
- efficient to parse to allow files of up to GB size (takes forever to parse with YAML),
- sequential and incorruptible,
- resilient to data loss.
Example
This is a valid son string:
{
"purpose": "store biography data",
"version": 0.1
}
===
{
"first name": "Hildegard",
"second name": "Kneef",
"age": 93
}
---
{
"first name": "Wiglaf",
"second name": "Droste",
"age": 57
}
It will be parsed into the metadata object, and a list containing the data objects with
import son
metadata, data = son.load('file.son')
Changelog
v.0.2.3: progress.bar
prints to stdout
instead of stderr
v.0.2.2: optionally be verbose and show progressbar with progress
package (optional dependency, install with pip install son[progress]
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file son-0.2.3.tar.gz
.
File metadata
- Download URL: son-0.2.3.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.7.3 Linux/4.15.0-54-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b142805905cb6e3f75c1f0f19f2d170b31286500d2ed76fc22fdd966a4422792 |
|
MD5 | 11f334de1bce24b8ad1dcf98d5cc63e5 |
|
BLAKE2b-256 | 26a4048c05fa75074acdbedc21e62d2552289e4659bec4120fc31a3411145e49 |
File details
Details for the file son-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: son-0.2.3-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/0.12.16 CPython/3.7.3 Linux/4.15.0-54-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fca6f8a5a114a9c5cea342c18443e2920841466bcc491724e4d5998b36f8ff1d |
|
MD5 | a4df23a0c366706ef72b446f01538cdf |
|
BLAKE2b-256 | 553ecdc5bb1b4aae6ff7e238d0d4021c941879ce56cb90f5d22beb9c75da826b |