threadsafe_datastore
Just released threadsafe_datastore, a simple, convenient thread-safe data store for Python.
I kept rebuilding this feature to pass around context within AI agents working on the same data across multiple threads. I kept wanting a simple atomic datastore that was convenient to work with. I originally built it for arkaine | git |. So - here it is as a stand alone package for easier use. I also improved context management for real easy multi-step operations in case you need to do something real custom.
from threadsafe_datastore import Datastore
store = Datastore()
store["counter"] = 0
store.increment("counter", 5) # Returns 5
# Nested dictionary support
store["nested"] = {"items": []}
store.append(["nested", "items"], "value1")
# Thread safe multi-step w/ context management:
with store as unlocked:
unlocked["a"] = 1
# This would be unsafe without the context:
unlocked["b"] = unlocked.get("a", 0) + 1
Give it a try: pip install threadsafe-datastore