MemoBox
MemoBox is a tiny, local, persistent memory store for Python programs.
It uses a JSON file, so there is no database server, account, API key, or setup required.
Install
pip install MemoBox
Quick start
from MemoBox import Brain
brain = Brain()
brain.remember("username", "sam")
brain.remember("theme", "dark")
print(brain.recall("username"))
# sam
print(brain.exists("theme"))
# True
brain.forget("theme")
Categories
brain.remember("python", "PyPI", category="interests")
brain.remember("robotics", "Arduino", category="interests")
print(brain.category("interests"))
Search
brain.remember("project", "MemoBox")
brain.remember("language", "Python")
print(brain.search("python"))
Custom storage path
brain = Brain("my_memory.json")
By default MemoBox stores data in .MemoBox/memory.json in the current working directory.
Expiring memory
You can store a value with an expiration time:
brain.remember("temporary", "hello", expires="1h")
Supported units:
s— secondsm— minutesh— hoursd— days
Examples: 30s, 10m, 2h, 7d.
API
Brain(path=None)
Creates a memory store.
remember(key, value, category=None, expires=None)
Stores or replaces a value.
recall(key, default=None)
Returns a value, or default if it does not exist.
forget(key)
Removes a key. Returns True if it existed.
exists(key)
Checks whether a non-expired key exists.
all(category=None)
Returns all stored values, optionally filtered by category.
category(name)
Returns all values in a category.
search(query)
Searches keys, categories, and stringified values.
clear(category=None)
Clears everything, or only one category.
Example
from MemoBox import Brain
brain = Brain()
brain.remember("username", "sam")
brain.remember("editor", "VS Code", category="tools")
brain.remember("language", "Python", category="tools")
print(brain.recall("username"))
print(brain.category("tools"))
print(brain.search("python"))
Development
Clone the repository and install the package in editable mode:
pip install -e ".[dev]"
Run tests:
pytest
Build the package:
python -m build
License
MIT
Metadata
Release files for memobox 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| memobox-0.1.1.tar.gz | 5.2 kB | Without provenance | Details for memobox-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| memobox-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for memobox-0.1.1-py3-none-any.whl |
Total release size: 10.8 kB
Release files / memobox-0.1.1.tar.gz
| Download URL | memobox-0.1.1.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a06198adaf66f2ace38096d691a002c234b16aef2dbc5c774fde74a542a4cc7d
|
|
BLAKE2b-256 checksum How to use checksums |
6af222d80408f3ff3649eec4356414b1aa944bb38f75250966559ee71d0e3746
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / memobox-0.1.1-py3-none-any.whl
| Download URL | memobox-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13d889c921515a56abad2304011bc1e5d82121482be7d6acb9aa098192d67664
|
|
BLAKE2b-256 checksum How to use checksums |
68e5c939cb4736fd1c943db600edbacbb8284220a4dd409b0097ae4aa7bb3b9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Security for memobox 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.