Persistent tree database for hierarchical metadata and file-backed datasets
Project description
LOTDB
Persistent tree database for hierarchical metadata and file-backed datasets.
LOTDB stands for Light Object Tree DB.
What it is
LOTDB stores data in StorageTree nodes:
- each node can contain child nodes
- each node can store arbitrary attributes
- the full tree can be persisted with ZODB
This is especially useful for dataset pipelines where folder structure, file references, and metadata all belong together.
Installation
Local editable install:
pip install -e .
With optional IO helpers:
pip install -e .[io]
Basic usage
from lotdb import StorageTree
tree = StorageTree(key="dataset")
node = tree.get_node_path(["speaker_01", "session_a", "clip_001"])
node.set_attribute("label", "hello")
print(node.get_attribute("label"))
Persistent database usage
from lotdb import LOTDB
db = LOTDB(path="./data", name="lotdb.fs", new=True)
tree = db.open_connection()
tree.get_node_path(["speaker_01", "clip_001"]).set_attribute("duration", 1.23)
db.commit()
db.close_connection()
db.close()
Backward compatibility
The old short method names still work:
ga()gn()gns()gna()
Readable wrappers were added so the API is easier to maintain and easier for weaker coding models to follow.
Import compatibility is also preserved for now:
- new import:
import lotdb - legacy imports still work:
import TreeDB,import StorageTree - new database class:
LOTDB - legacy alias still works:
StorageTreeDatabase
Development
- source packages live in
src/lotdbandsrc/TreeDB - tests live in
tests/ - API notes live in
docs/API.md
Publishing
PyPI publishing is configured with GitHub Actions via trusted publishing.
Recommended setup:
- create a PyPI project named
lotdb - add a trusted publisher on PyPI for this GitHub repository
- publish by creating a GitHub release
TestPyPI is also configured.
Recommended rollout:
- first connect this repo to TestPyPI trusted publishing
- trigger the
Publish to TestPyPIworkflow manually or with a tag liketest-v1.1.1 - verify install from TestPyPI
- then connect the same repo/workflow to real PyPI
- publish a GitHub release for the real upload
Example test install:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple lotdb
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lotdb-1.1.1.tar.gz.
File metadata
- Download URL: lotdb-1.1.1.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51252eb2b96041829e0491fba6e5846492f39184fb5cffc6bc7f87d0ff701df2
|
|
| MD5 |
dd5f537d3beba9578937c221892b46ae
|
|
| BLAKE2b-256 |
525c6470526658fc88b0b36a419ddb2b2bce380e1df215fd2e710ce7a8ceb089
|
File details
Details for the file lotdb-1.1.1-py3-none-any.whl.
File metadata
- Download URL: lotdb-1.1.1-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68c0ba5302504f3f669616dc443a02d58bb9c46d275ee92ba0a003420af4967b
|
|
| MD5 |
bee7531c5e95decd10b9175602028984
|
|
| BLAKE2b-256 |
4978faa7b6646a0597b0c9e3447e0b3a2fbc277450fef0df97b016d057f8a4e2
|