Thread-safe, lightweight and persistent dict for Python with a magical touch.
pip install magic-container
Use it like a dict:
from container import container
container["key"] = 3
print(container["key"])
del container["key"]
Or get the values while setting them if there aren't in the container:
from container import container
print(container.get("second_key", lambda: 23))
- Currently only works if installed and used in a virtual environment with write access to the venv folder.
- Currently keys can only be strings.
- Currently only the
get
,set
anddelete
methods are defined.