ITADN
Boss-1s/key_multivalue_storage
README.md

Key to Multivalue Storage - kms

kms - a tiny side project tuned into a library.

JSON storage wrapper and editor. Created with love by Boss_1s.

Once upon a time, this was just a small project to solve a problem: the over-steep learning curve for scratchattach's database functionality. Now, I have decided to make it a library, something with humble beginnings with big hopes in its future.

This is, after all, the greatest piece of a CPython progam I have made. ;)


Badges

Download

CPython Package Beta Nightly

Status

Release Tests

Quality gate

Info & Docs

Changelog PyPI - Version Documentation License Contributing Security


Installation

Install with pip:

pip install -U key-multivalue-storage

Or, download the latest version of the .whl file in the releases page

You can also choose to download the development environment alongside the package:

pip install -U key-multivalue-storage[dev]

The development package includes Pylint and Griffe for testing and finding breaking changes. You can see the tests in the test folder.

See more about tests here.

Usage

  • Create a Storage object to wrap the data to be stored:
from key_multivalue_storage import Storage
my_db = Storage("my_top_level_key", mysubkey="myvalue", myothersk="anotherval")
  • To store the object, use Storage.store().
my_db.store("database.json")
  • You can change certain global variables for each Storage instance.
Storage.indent = 4 # indent size of JSON files
Storage.encode = True # Whether to encode stored values
Storage.auto_delete_self = True
# Whether to automatically release the object
# from memory after certain operations i.e.
# Storage.store()

See the full documentation here!

Contribute

Roadmap

Report a Bug