redb
Python bindings for redb, a simple, portable, high-performance, ACID, embedded key-value store.
The bindings use the same file format as the Rust crate, so a database can be read and written from both languages.
pip install redb
Requires Python 3.12 or later.
import redb
TABLE = redb.TableDefinition("my_data", redb.str, redb.u64)
with redb.Database.create("my_db.redb") as db:
with db.begin_write() as txn:
table = txn.open_table(TABLE)
table["my_key"] = 123
read_txn = db.begin_read()
table = read_txn.open_table(TABLE)
assert table["my_key"] == 123
Leaving the with block closes the database, as close() does. Close every database you open
rather than leaving it to the garbage collector: a process can exit without collecting it, for
example through os._exit(), as multiprocessing workers started with fork do, or while a
daemon thread still uses it. The file is then left needing a repair. The next writer to open it
repairs it, and until then redb.open_read_only() raises redb.RepairAborted.
Features
- Tables support
table[key],table[key] = value,del table[key],key in tableandlen(table)as adictdoes, along withget(),range(),first(),last(),pop_first(),pop_last()andretain(). Iterating a table, or arange()of it, yields(key, value)pairs in key order - Fully ACID-compliant transactions. Leaving a
with db.begin_write()block commits the transaction, or aborts it if an exception was raised - Concurrent readers and a writer, in one process or in several
- Savepoints and rollbacks
- Compaction and integrity checking
Types
Keys and values are typed. The types are redb.bytes, redb.str, redb.bool, redb.u64,
redb.i64, redb.u128, redb.i128, and redb.f64. f64 can only be used for values, since
floats have no total order. The Python builtins bytes, str, bool and float can be used in
place of the redb type of the same name. Keys are sorted in redb's order: integers numerically,
bytes and str lexicographically.
Multiple processes
One process can open a database for writing with redb.open() while any number of other
processes open it for reading with redb.open_read_only(). Each read transaction sees the latest
commit.
To allow more than one writer process, open the database with concurrency=redb.MultiWriter in
every process. Write transactions run one at a time, across processes as within one:
begin_write() waits while another is in progress. Waiting writers are not served in order, so a
writer that begins again as soon as it commits can keep the others waiting.
import redb
db = redb.open("my_db.redb", concurrency=redb.MultiWriter)
A database, and the transactions and tables opened from it, belong to the process that opened
it. A forked child, such as a multiprocessing worker started with fork, must open the database
itself: using an inherited one raises redb.UsedAfterFork.
Development
The bindings are built with maturin and developed with
uv, which installs maturin and the test dependencies itself.
just install_py builds the bindings into crates/redb-python/.venv, just test_py runs the
tests, and just fuzz_py runs the Hypothesis-based fuzzer.
License
Licensed under either of the Apache License, Version 2.0 or the MIT License, at your option.
Metadata
Release files for redb 0.6.0
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 |
|---|---|---|---|---|
| redb-0.6.0.tar.gz | 516.0 kB | With provenance | Details for redb-0.6.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| redb-0.6.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for redb-0.6.0-cp312-abi3-win_amd64.whl |
| redb-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ x86-64 | Details for redb-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
| redb-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.17+ ARM64 | Details for redb-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
| redb-0.6.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for redb-0.6.0-cp312-abi3-macosx_11_0_arm64.whl |
| redb-0.6.0-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details for redb-0.6.0-cp312-abi3-macosx_10_12_x86_64.whl |
Total release size: 10.7 MB
Release files / redb-0.6.0.tar.gz
| Download URL | redb-0.6.0.tar.gz |
|---|---|
| Size | 516.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c4c9936c79d712a1eab1e22fb8ec997edeee03da06ddbfff8b866a46d78dc3b
|
|
BLAKE2b-256 checksum How to use checksums |
f2406caf94b68c240392490795f647136f08c688d901d2bdfa9b91f0f23b1176
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / redb-0.6.0-cp312-abi3-win_amd64.whl
| Download URL | redb-0.6.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ba63fdea183891033ebf3effbf11e19783977330b626d911440642044c109145
|
|
BLAKE2b-256 checksum How to use checksums |
c3e60ab4d842adac1d00aca49c9b61576a9b95ed5b8b7c3d7139f980553e9924
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / redb-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
| Download URL | redb-0.6.0-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
bde03a783e260c85d406beaf4ba23d9c6ea65dae06d12ac03c235a35ef67eec6
|
|
BLAKE2b-256 checksum How to use checksums |
37e6d4783069703851a2cc41820e7bb3f4732ab0a230bfd6e5a7e36e7de52707
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / redb-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
| Download URL | redb-0.6.0-cp312-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
59854dfb80663b6772ca410961041f5578711a6ab2899486f9d4c1443a7ba46a
|
|
BLAKE2b-256 checksum How to use checksums |
725becf11d81c233ee29be8b9f5999b125493acb07923dce5e8afa8aec81639a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / redb-0.6.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | redb-0.6.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7f135e07aea488421c9ca23d9f251964618ee625826542d59f5a5ef11276070c
|
|
BLAKE2b-256 checksum How to use checksums |
9220b4b965402f2edf08cf9467a83b95f620dcf9cffb115ce37c86714ee6a744
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / redb-0.6.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | redb-0.6.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
77430a6205ab40c5e657189512453299e7459ae7d348baff259f82ea848071b8
|
|
BLAKE2b-256 checksum How to use checksums |
1a5f7be8ec0ddb3c5d426b08eaa47733b1f6617228e251a4fc395de3e601b178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for redb 0.6.0
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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for redb-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA 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.