Metadata-Version: 2.4
Name: tketool.storage
Version: 1.3.5
Summary: Extensible data structures over pluggable ordered storage backends
Author-email: Ke <jiangke1207@icloud.com>
License-Expression: MIT
Project-URL: Homepage, https://pypi.org/project/tketool.storage/
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Provides-Extra: sql
Requires-Dist: SQLAlchemy<3,>=2.0; extra == "sql"
Provides-Extra: postgresql
Requires-Dist: SQLAlchemy<3,>=2.0; extra == "postgresql"
Requires-Dist: psycopg[binary]<4,>=3.2; extra == "postgresql"
Provides-Extra: redis
Requires-Dist: redis<9,>=6; extra == "redis"
Provides-Extra: test
Requires-Dist: pytest<9,>=8; extra == "test"
Requires-Dist: SQLAlchemy<3,>=2.0; extra == "test"
Requires-Dist: redis<9,>=6; extra == "test"

# tketool.storage

Extensible graphs, trees, maps, lists, and linked lists over replaceable
ordered storage backends.

```bash
pip install tketool.storage
```

```python
from tketool.storage import Graph, MemoryBackend, PersistentMap, Tree

backend = MemoryBackend()
settings = PersistentMap(backend, "settings")
settings.put("language", "zh-CN")

graph = Graph(backend, "knowledge")
person = graph.add_node("alice", {"name": "Alice"}, type="person")
```

Optional adapters:

```bash
pip install "tketool.storage[sql]"
pip install "tketool.storage[postgresql]"
pip install "tketool.storage[redis]"
```

The dependency-free adapters are `MemoryBackend` and `SQLiteBackend`.
`SQLAlchemyBackend` uses SQLAlchemy Core and database-specific drivers;
`RedisBackend` uses redis-py and an atomic Lua batch.

The old `tketool.ml`/`tketool.ml2` and domain-specific `StorageBase` APIs are
not retained. New backends only
implement point read, ordered scan, atomic batch, and transaction primitives;
new data structures compose those primitives without changing adapters.
