Skip to main content

SciSave - Serialization for Scientific Data

Project description

SciSave - Serialization for Scientific Data

Summary

SciSave is a Python serialization/deserialization module:

  • Specially targeted for scientific applications.
  • Load JSON/YAML configuration files.
  • Load and write JSON/Pickle data 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 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
  • .pck, .pkl, .pickle - for Pickle files

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

SciSave is written in Python (NumPy, PyYAML, 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
  • 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scisave-1.5.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scisave-1.5.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file scisave-1.5.0.tar.gz.

File metadata

  • Download URL: scisave-1.5.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.11

File hashes

Hashes for scisave-1.5.0.tar.gz
Algorithm Hash digest
SHA256 b15eacc9014294233a1d3ccd172206f48d069a81c6346d28863596e7a27f5e31
MD5 f5448bf38c22db190f213c5fc0a9a068
BLAKE2b-256 df8fa65107c3d22c7f285c070368289597c7da86703d463c4832358ac6fa6b31

See more details on using hashes here.

File details

Details for the file scisave-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: scisave-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.11

File hashes

Hashes for scisave-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0455beed4fa8d12a293b115ddfd97d158ddc5d50cb4c990ae088e2900301159
MD5 3122a4c35e8d2b17607c96f27d92091d
BLAKE2b-256 056b07fc9dba35a6224539243fd7ee822da26002089d3fe2126531580ccf6d6a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page