Reusable model primitives for projects that store Python objects with dbzero.
dbzero-modelkit provides small, focused building blocks for common model patterns:
sparse calendars, active-date windows, month-indexed storage, multilingual strings,
FIFO queues, and tag-based object locks. The package is application-neutral and is
intended to be imported by any Python project using dbzero.
pip install dbzero-modelkitRequirements:
- Python 3.9 or newer
- dbzero>=0.3.0
ActiveBaseandActiveIndexfor objects that are active only within a date or datetime range.Calendar,MonthCalendar,get_month_index, andget_date_from_month_indexfor sparse date-based values.LanguageCodeandML_Stringfor primary text values with optional translations.FiFoQueueandFQ_Itemfor dbzero-backed FIFO queues.MonthStorefor one-object-per-month storage with lazy item creation.ObjectLockfor temporary tag-based locking of dbzero objects.
Initialize dbzero before creating or loading dbzero-backed model objects:
from datetime import date
import dbzero as db0
from dbzero_modelkit import Calendar, FiFoQueue
db0.init("./db0_data", read_write=True)
db0.open("main", "rw")
calendar = Calendar(base_year=2026)
calendar.set(date(2026, 1, 1), "available")
queue = FiFoQueue()
queue.push_back(kind="email", recipient="user@example.test")
assert calendar.get(date(2026, 1, 1)) == "available"
assert queue.pop_front(1) == [
{"kind": "email", "recipient": "user@example.test"},
]
db0.close()