Skip to main content

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 StorageTreeDatabase

db = StorageTreeDatabase(path="./data", name="treedb.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

Development

  • source packages live in src/lotdb and src/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 TestPyPI workflow manually or with a tag like test-v1.1.0
  • 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

lotdb-1.1.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lotdb-1.1.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file lotdb-1.1.0.tar.gz.

File metadata

  • Download URL: lotdb-1.1.0.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

Hashes for lotdb-1.1.0.tar.gz
Algorithm Hash digest
SHA256 064b796b434d9a04e0c2a93c5752d8aebaca238c4671a1207a523c26d2391dac
MD5 f4ce57317c63a173fb5ddfe8ef0ed913
BLAKE2b-256 d13ee6622b3e78bd09eb6100d377ec1c56c58da247d8f8174ca5979b5ea55149

See more details on using hashes here.

File details

Details for the file lotdb-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: lotdb-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for lotdb-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b1e81f3b0e28140ff173c95d09d90336eb81a45ccd91ef6012e08aab96a61d3
MD5 13cba22b964b9236b666ea3d793d0a08
BLAKE2b-256 cc6dc6ed9d97293b24449de58cee605ee6a749e8ba39b65d62e4bf70a3da0cfb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page