Skip to main content

SciSave - Serialization for Scientific Data

Summary

SciSave is a Python serialization/deserialization module:

  • Specially targeted for scientific applications.
  • Load and write JSON/MessagePack/Pickle data files.
  • Load JSON/YAML configuration files.
  • Validate data with JSON schemas.

For YAML files, the following custom extensions are used:

  • Parse relative paths with respect to the YAML file (!path).
  • Include other YAML files into the YAML file (!include).
  • Evaluate a Python literal using literal_eval (!eval).
  • Substitute YAML strings with values from environment variables (!env).
  • Substitute YAML strings with values from a provided dictionary (!sub).
  • Merge a list of dicts (!merge_dict).
  • Merge a list of lists (!merge_list).

For JSON files, the following custom extensions are used:

  • Allows the serialization/deserialization of complex numbers (__complex__).
  • Allows the serialization/deserialization of NumPy arrays (__numpy__).
  • Allows the serialization/deserialization as/from text and gzip files

For MessagePack files, the following custom extensions are used:

  • Allows the serialization/deserialization of complex numbers (__complex__).
  • Allows the serialization/deserialization of NumPy arrays (__numpy__).

For JSON schemas, the following custom extensions are used:

  • Handling NumPy types (integer, floating, and complex).
  • Handling NumPy multidimensional arrays.

The following file extensions are used:

  • .yaml, .yml - for YAML files
  • .json, .js - for JSON text files
  • .gz, .gzip - for JSON gzip files
  • .mpk, .msg", .msgpack - for MessagePack files
  • .pck, .pkl, .pickle - for Pickle files

The JSON/YAML/MessagePack files with the custom extensions are still valid files. Pickle/MessagePack is typically faster than JSON for very large data files.

SciSave is written in Python (NumPy, PyYAML, msgpack, and jsonschema are the only dependencies). SciSave is respecting semantic versioning (starting from version 1.4).

Warning

  • Pickling data is not secure.
  • Only load pickle files that you trust.

Example

An example is located in the example folder of the repository:

  • run_data.py contains an example file for the loader/dumper
  • run_bench.py contains a simple benchmark for the different formats
  • config_main.yaml YAML configuration file with custom extensions
  • config_include.yaml YAML configuration file for include extension
  • config_schema.yaml YAML file containing the JSON schema definition
  • dump.json JSON text file for testing data dumping/loading
  • dump.gz JSON gzip file for testing data dumping/loading
  • dump.pickle Pickle file for testing data dumping/loading

Project Links

Author

Copyright

(c) 2023 - Thomas Guillod

BSD 2-Clause "Simplified" License

Metadata

Release files for scisave 1.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scisave 1.6.0
File Size Uploaded
scisave-1.6.0.tar.gz 15.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scisave 1.6.0
File Interpreter ABI Platform
scisave-1.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.6 kB

Release files / scisave-1.6.0.tar.gz

Download URL scisave-1.6.0.tar.gz
Size 15.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cc417f1b4fbe27d343eca5698a7feee9328bc422f030f5ea3335d87852803983
BLAKE2b-256 checksum
How to use checksums
3d6a8752d8f04b817b476a553afe2267da14743e817bf60c5139d3309febf070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.11

Release files / scisave-1.6.0-py3-none-any.whl

Download URL scisave-1.6.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb2b9a942ec8f356aee293cb9843383c5ceff04d3ec545a0f5efd2f0de0526af
BLAKE2b-256 checksum
How to use checksums
a767e18d76c3325a2a609adec3cd5d4a17d7c344f3f4cd5f4f720bc64e2ef883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.11

Release history Release notifications | RSS feed

This release

1.6.0 This release

2 release files

1.5.0

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page