Skip to content

Commit ae04d3c

Browse files
authored
Revise README with detailed project information
Expanded project description and added features, installation, usage examples, supported types, and use cases.
1 parent a48e87b commit ae04d3c

1 file changed

Lines changed: 184 additions & 5 deletions

File tree

README.md

Lines changed: 184 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,187 @@
11
# Rheel Data Management
22

3-
This python project reinvents data management. This mildly-fast module protects and saves your data in .rdm files.
3+
Strictly-typed, human-readable data management for Python.
44

5-
Why use this instead of json or toml?
6-
It's (strictly) typed, human readable, section-based and you can edit it on the go (if you load and save it on every use).
7-
It also has corruption-protection with atomic file rewrites.
8-
It supports all native python types as well as datetime and pathlib.Path, but with the local custom type registry you can add as many types as you like (check source code for usage)!
5+
Rheel Data Management (RDM) provides a clean `.rdm` file format and
6+
Python API for structured, section-based data storage with enforced
7+
types.
8+
9+
It is designed for developers who want more structure and type safety
10+
than JSON or TOML --- without the complexity of a database.
11+
12+
------------------------------------------------------------------------
13+
14+
## ✨ Features
15+
16+
- ✅ Strict type enforcement
17+
- ✅ Native Python type support
18+
- ✅ Nested generics (`list[int]`, `dict[int, str]`)
19+
- ✅ Union types (`str | int`)
20+
- ✅ Mixed generics (`list[str | int]`)
21+
- ✅ Section-based structure
22+
- ✅ Human-readable format
23+
- ✅ Atomic file saves (corruption protection)
24+
- ✅ Custom type registry
25+
- ✅ Supports `datetime`, `date`, `time`, and `pathlib.Path`
26+
27+
------------------------------------------------------------------------
28+
29+
## 📦 Installation
30+
31+
``` bash
32+
pip install Rheel-Data-Management
33+
```
34+
35+
------------------------------------------------------------------------
36+
37+
## 📥 Import
38+
39+
``` python
40+
import rheelDM
41+
```
42+
43+
------------------------------------------------------------------------
44+
45+
## 📄 Example `.rdm` File
46+
47+
``` rdm
48+
[user123]
49+
name : str = "CoCo"
50+
score : int = 42
51+
tags : list[str] = ["admin", "tester"]
52+
prefs : dict[int,str] = {1: "dark", 2: "light"}
53+
```
54+
55+
Clean. Typed. Readable.
56+
57+
------------------------------------------------------------------------
58+
59+
## 🚀 Basic Usage
60+
61+
### Create and Save
62+
63+
``` python
64+
import rheelDM
65+
66+
data = rheelDM.Obj()
67+
68+
user = data.section("user123")
69+
user.set("name", str, "CoCo")
70+
user.set("score", int, 42)
71+
user.set("tags", list[str], ["admin", "tester"])
72+
user.set("prefs", dict[int, str], {1: "dark", 2: "light"})
73+
74+
data.save("botdata.rdm")
75+
```
76+
77+
------------------------------------------------------------------------
78+
79+
### Load Data
80+
81+
``` python
82+
loaded = rheelDM.Obj.load("botdata.rdm")
83+
84+
user = loaded.section("user123")
85+
86+
print(user.get("name")) # "CoCo"
87+
print(user.get("score")) # 42
88+
```
89+
90+
------------------------------------------------------------------------
91+
92+
## 🧠 Supported Types
93+
94+
### Native Python Types
95+
96+
- `str`
97+
- `int`
98+
- `float`
99+
- `bool`
100+
- `list[T]`
101+
- `set[T]`
102+
- `tuple[T]`
103+
- `dict[K, V]`
104+
- Nested generics (e.g. `list[dict[int, str]]`)
105+
- Union types (`str | int`)
106+
- Mixed generics (`list[str | int]`)
107+
108+
------------------------------------------------------------------------
109+
110+
### Date & Path Types
111+
112+
- `datetime`
113+
- `date`
114+
- `time`
115+
- `Path`
116+
117+
Example:
118+
119+
``` python
120+
from datetime import datetime
121+
from pathlib import Path
122+
123+
data.section("user").set("last_login", datetime, datetime.now())
124+
data.section("user").set("config_path", Path, Path("config/settings.txt"))
125+
```
126+
127+
------------------------------------------------------------------------
128+
129+
## 🧩 Custom Type Registry
130+
131+
You can register your own types globally.
132+
133+
``` python
134+
import rheelDM
135+
136+
class Color:
137+
def __init__(self, hex_code: str):
138+
self.hex = hex_code
139+
140+
rheelDM.TypeRegistry.register(
141+
"Color",
142+
Color,
143+
lambda v: f'"{v.hex}"',
144+
lambda v: Color(v.strip('"'))
145+
)
146+
```
147+
148+
Now you can use it like any native type:
149+
150+
``` python
151+
data.section("settings").set("theme", Color, Color("#ff8800"))
152+
```
153+
154+
------------------------------------------------------------------------
155+
156+
## 🛡 Why RDM Instead of JSON?
157+
158+
### Strict Typing
159+
160+
JSON does not enforce types.\
161+
RDM validates everything on write and load.
162+
163+
### Python-Native Types
164+
165+
JSON cannot store: - `datetime` - `Path` - `set` - `tuple` - Union types - Nested generics
166+
167+
RDM can.
168+
169+
### Cleaner Structure
170+
171+
Section-based format keeps large files organized and readable.
172+
173+
### Human Editable
174+
175+
Minimal syntax:
176+
177+
key : type = value
178+
179+
------------------------------------------------------------------------
180+
181+
## 🎯 Ideal Use Cases
182+
183+
- Game save systems
184+
- Discord bot data
185+
- Typed configuration systems
186+
- CLI tool configs
187+
- Small to medium persistent data storage

0 commit comments

Comments
 (0)