summaryrefslogtreecommitdiff
path: root/README.md
blob: 7eebf3e2cacf78329476bdae18607ca47afcb268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# ymlstash

A simple ORM-like utility for operating on local YAML files via Python dataclasses.

Define a dataclass:

```python
from dataclasses import dataclass

@dataclass
class User:
    name: str
    age: int
    active: bool
```

Instantiate a new object:

```python
user = User(name="yuval", age=42, active=True)
```

Save it to file:

```python
from ymlstash import YmlStash

stash = YmlStash(User, "path/to/db")
stash.save("yuval", user)
```

Load from file:

```python
user = stash.load("yuval")
```