Metadata-Version: 2.4
Name: sjdbl
Version: 0.6.0
Summary: Seecr Json Database Lib: Python objects as plain JSON files, with crash-safe transactions
Author-email: Thijs Janssen <thijs@seecr.nl>, Johan Jonkers <johan@seecr.nl>
License-Expression: MIT
Project-URL: Documentation, https://github.com/seecr/sjdbl/blob/master/doc/reference.md
Project-URL: Source, https://github.com/seecr/sjdbl
Project-URL: Issues, https://github.com/seecr/sjdbl/issues
Project-URL: Changelog, https://github.com/seecr/sjdbl/blob/master/CHANGELOG.md
Keywords: json,store,storage,persistence,transactions,seecr
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: POSIX
Classifier: Intended Audience :: Developers
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: lxml<7,>=6.1.3
Requires-Dist: pytest<10,>=9.2.0
Dynamic: license-file

# sjdbl – Seecr Json Database Lib

Stores Python objects as plain JSON files: one file per object, one directory per
class. Crash-safe transactions, revisions against lost updates, lazy references,
sequential numbers. No server, no query language: searching belongs in an index that
can be rebuilt from the files at any time.

```python
from pathlib import Path

from sjdbl import Store
from sjdbl.base import Base
from sjdbl.field import Field


class Person(Base):
    FIELDS = [Field.str("name"), Field.date("dob"), Field.reference("parent")]


store = Store(path=Path("data"), models=[Person])
john = Person.create(name="John Smith")
store.put(john)                              # data/Person/<id>.json

with store.transaction():                    # all of it, or nothing
    john.update(name="John Doe")
    store.put(john, Person.create(name="Joe", parent=john))
```

- **Plain text.** Every object is a readable, indented JSON file: `cat`, `grep`, `diff`
  and fix it by hand.
- **No server.** A store is a directory; a backup is a copy of it.
- **Crash safe.** A transaction is in the files completely or not at all, also when the
  machine dies halfway.

Install with `pip install sjdbl`. It needs Python 3.11 or newer, lxml and pytest
(the tests are part of the package).

The [reference](https://github.com/seecr/sjdbl/blob/master/doc/reference.md) describes
everything; [examples](https://github.com/seecr/sjdbl/tree/master/examples) has runnable
scripts; the [changelog](https://github.com/seecr/sjdbl/blob/master/CHANGELOG.md) says
what changed.

MIT licensed, see [LICENSE](https://github.com/seecr/sjdbl/blob/master/LICENSE). By
[Seecr](https://seecr.nl).
