Metadata-Version: 2.1
Name: yaml-sync
Version: 0.1.1
Summary: A simple YAML-based cache for Python
Home-page: https://github.com/organisciak/yaml-cachesync
Author: Peter Organisciak
Author-email: organisciak@gmail.com
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Description-Content-Type: text/markdown
Requires-Dist: PyYAML (>=5.1)

## yamlsync

Yaml Sync is a *very* lightweight YAML-based cache for when you want to preserve the state of something on disk in a human readable way.

## Installation

To install Yaml Sync, simply run:

```bash
pip install yaml-cache
```


## Example usage

Here's a quick example of how to use Yaml Sync:

```
from yaml_sync import YamlCache

# Create a cache that reads and writes to the specified file
cache = YamlCache('cache.yaml', mode='rw')

# Save a key to the cache and write to disk
cache['hello'] = 'world'

# Check if a key is in the cache
assert 'hello' in cache

# Retrieve a key from the cache
variable = cache['hello']

# Save a list to the cache
cache['list_example'] = [1, 2, 3]
```

The resulting yaml will be:

```
hello: world
list_example:
  0: 1
  1: 2
  2: 3
```

You can pass `number_lists=True` at init to save any lists as a numbered dictionary. Since the goal of Yaml Sync is a human-readable file, the numbering may be desired in some cases.

## License
This project is licensed under the [MIT License](https://opensource.org/license/mit/).
