Metadata-Version: 2.4
Name: key-multivalue-storage
Version: 1.3.2.20260826b2
Summary: A simple library that allows the JSON storage of one key to multiple values.
Author: Boss_1s
License-Expression: GPL-2.0-only
Project-URL: Documentation, https://boss-1s.github.io/key_multivalue_storage
Project-URL: Repository, https://github.com/Boss-1s/key_multivalue_storage/
Project-URL: Issues, https://github.com/Boss-1s/key_multivalue_storage/issues/
Keywords: json,json wrapper,python,database,storage,wrapper-library
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database
Classifier: Topic :: File Formats :: JSON
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: dill
Requires-Dist: rich==15.0.0
Requires-Dist: typing-extensions~=4.16
Provides-Extra: dev
Requires-Dist: pylint==4.0.7; extra == "dev"
Requires-Dist: pylint-per-file-ignores==3.2.1; extra == "dev"
Requires-Dist: griffe==2.2.0; extra == "dev"
Dynamic: license-file

# 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](https://github.com/TimMcCool/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](https://img.shields.io/badge/CPython-3.12%20%7C%203.13%20%7C%203.14-blue?style=for-the-badge)](https://www.python.org/downloads/release/python-3122/)
[![Package](https://img.shields.io/badge/Stable%20Package-PyPi-violet?style=for-the-badge)](https://pypi.org/project/key-multivalue-storage/)
[![Beta Nightly](https://img.shields.io/badge/Nightly%20Package-kms--semver1%2E3%2Ex%20Nightly-purple?style=for-the-badge)](https://nightly.link/boss-1s/key_multivalue_storage/workflows/test.yml/semver1.3.x/full-kms-semver-1-3-nightly.zip)

### Status

[![Release](https://img.shields.io/github/actions/workflow/status/Boss-1s/key_multivalue_storage/.github%2Fworkflows%2Frelease.yml?style=for-the-badge&label=Release&labelColor=maroon)](https://github.com/Boss-1s/key_multivalue_storage/deployments/release)
[![Tests](https://img.shields.io/github/actions/workflow/status/Boss-1s/key_multivalue_storage/.github%2Fworkflows%2Ftest.yml?style=for-the-badge&label=Tests&labelColor=blue)](https://github.com/Boss-1s/key_multivalue_storage/deployments/test)

[![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=Boss-1s_key_multivalue_storage)](https://sonarcloud.io/summary/new_code?id=Boss-1s_key_multivalue_storage)

### Info & Docs

[![Changelog](https://img.shields.io/badge/Changelog-Click%20Here-gray?style=for-the-badge&labelColor=blue)](https://boss-1s.github.io/key_multivalue_storage/CHANGELOG)
[![PyPI - Version](https://img.shields.io/pypi/v/key-multivalue-storage?style=for-the-badge&label=Latest&color=gray&labelColor=purple)](https://github.com/Boss-1s/key_multivalue_storage/releases)
[![Documentation](https://img.shields.io/badge/Documentation-Click-gray?style=for-the-badge&labelColor=blue)](https://boss-1s.github.io/key_multivalue_storage)
[![License](https://img.shields.io/pypi/l/key-multivalue-storage?style=for-the-badge&color=gray&labelColor=%230a6149)](https://github.com/Boss-1s/key_multivalue_storage/blob/main/LICENSE)
[![Contributing](https://img.shields.io/badge/Contribution%20Guidelines-Click-gray?style=for-the-badge&labelColor=orange)](https://boss-1s.github.io/key_multivalue_storage/contribution-guidelines)
[![Security](https://img.shields.io/badge/Versioning%20%26%20Security-Click-gray?style=for-the-badge&labelColor=red)](https://boss-1s.github.io/key_multivalue_storage/security)

_____________

## Installation
Install with `pip`:
```bash
pip install -U key-multivalue-storage
```

Or, download the latest version of the `.whl` file [in the releases page](https://github.com/Boss-1s/key_multivalue_storage/releases)

You can also choose to download the development environment alongside the package:
```sh
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](https://github.com/Boss-1s/key_multivalue_storage/blob/semver1.3.x/test/). 

[*See more about tests here.*](https://boss-1s.github.io/key_multivalue_storage/Development)

## Usage
- Create a Storage object to wrap the data to be stored:
```py
>>> from key_multivalue_storage import Storage
>>> my_db = Storage("my_top_level_key", mysubkey="myvalue", myothersk="anotherval")
```
- To store the object, use `Storage.store()`.
```py
>>> my_db.store("database.json")
Data stored successfully in 'database.json'.
```
- You can change certain global variables for each `Storage` instance.
```py
>>> Storage.indent = 4 # indent size of JSON files
>>> Storage.encode = True # Whether to encode stored values
```
- Load the data back into a Storage object:
```py
>>> import key_multivalue_storage as kms
>>> loaded_db = kms.Load.by_key("database.json", "my_top_level_key") # You can also use Storage.Load.by_key()
>>> loaded_db = my_db
True
```
- You can also cast a Storage object into a dictionary!
```py
>>> dict_db = dict(my_db)
>>> dict_db
{"my_top_level_key":{"mysubkey":"myvalue","myothersk":"anotherval"}}
```

There's a _lot_ more to this library that what _meets the eye_.

### See the full documentation [here](https://boss-1s.github.io/key_multivalue_storage)!

## [Contribute](https://github.com/Boss-1s/key_multivalue_storage/fork)
## [Roadmap](https://github.com/Boss-1s/key_multivalue_storage/wiki/Roadmap#possible-future-features)
## [Report a Bug](https://github.com/Boss-1s/key_multivalue_storage/issues)


Have a GREAT day/night! :)
