A tiny database for Python
Project description
shelfdb
Tiny LMDB-backed shelf database utilities.
Installation
pip install shelfdb
[!WARNING] The client/server protocol uses
dillto support Python callables. Only use it between trusted processes; do not expose the server to untrusted clients or public networks.
Development
Install development dependencies:
uv sync --dev
Run the complete non-publishing release gate:
uv run python -m dev release-check
The gate audits locked dependencies, checks formatting, linting, types, supported
Python versions, strict documentation, release artifacts, metadata, and a clean
wheel installation. GitHub Actions runs the same gate on pull requests, main,
and version tags.
Serve the docs locally:
uv run python -m dev docs serve --port 9001 --livereload
Publish the docs with mike to the docs branch:
uv run python -m dev docs publish
Override the publish target when needed:
uv run python -m dev docs publish --publish-version 3.0.1 --alias latest --branch docs --remote origin
Server
Run the protocol server:
shelfdb server
Run the protocol server on a custom address:
shelfdb server --url "tcp://0.0.0.0:17001" --db-path ./db
Client
Connect a client:
from shelfdb.client import Client
client = await Client.connect("tcp://127.0.0.1:31337")
Unix sockets also work:
from shelfdb.client import Client
client = await Client.connect("unix:///tmp/shelfdb.sock")
Example
from shelfdb.client import Client
client = await Client.connect("tcp://127.0.0.1:31337")
try:
async with client.transaction() as tx:
users = tx.shelf("users")
count = await users.count().query()
alice = await users.key("alice").item().query()
admins = await users.filter(
lambda item: item.value["role"] == "admin"
).sort(reverse=True).query()
async with client.transaction(write=True) as tx:
users = tx.shelf("users")
await users.put("eve", {"role": "user"}).query()
await users.key("eve").update(
lambda item: {**item.value, "role": "admin"}
).query()
finally:
await client.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shelfdb-3.0.1.tar.gz.
File metadata
- Download URL: shelfdb-3.0.1.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c721093c1bdd5d6a60f74760d137b5f45e5c8a1252c959bc9c149a1884529141
|
|
| MD5 |
4059e1ff39d15a775c2f7ac3e46e6cce
|
|
| BLAKE2b-256 |
64115c4f28799aa91c5cc8740c760b29b4677727b92fc7f780a2c587791928e0
|
File details
Details for the file shelfdb-3.0.1-py3-none-any.whl.
File metadata
- Download URL: shelfdb-3.0.1-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f1e88429c10b9f5252578e8aa0c10a4b235b6b5d1860e98ae63129a10089a1c
|
|
| MD5 |
1753cf5002b0356800a628e8dce28665
|
|
| BLAKE2b-256 |
fd57df7214fec866c76a9baad0a946c9e712d8938e35decb265640835e59e3e4
|