Skip to main content

No project description provided

Project description

wrap-rocks

Minimal Python bindings for RocksDB
Built with PyO3, powered by RocksDB, and packaged via maturin.

🚀 Features

  • Fast key-value store backed by RocksDB.
  • Pythonic API with support for both strings and bytes.
  • Optional compression: zstd (default) or snappy.
  • Toggleable WAL (Write-Ahead Log) behavior.
  • Lightweight, no-dependency interface for read/write/delete operations.
  • Wheels for Python 3.8–3.13 (manylinux-compatible).

📦 Installation

pip install wrap-rocks

Or, from source (requires Rust and maturin):

maturin develop

🐳 Building with Docker

You can build wheels locally using the provided Dockerfile, or use the prebuilt image on Docker Hub. The container should support every python version from 3.8 to 3.13.

Option 1: Build your own image

sudo docker build -t wrap-rocks -f docker/Dockerfile .
sudo docker run --rm -v $(pwd):/io wrap-rocks python3.13 -m maturin -i python3.13 build --release

Option 2: Use the prebuilt image

sudo docker pull saferq/wrap-rocks:local
sudo docker run --rm -v $(pwd):/io saferq/wrap-rocks:local python3.13 -m maturin -i python3.13 build --release

🧪 Example

from wrap_rocks import RocksDB

# Open or create the database
db = RocksDB("mydb", compression="snappy")

# Store string data
db.put("seq1", "AGCT")
print(db.get("seq1"))  # "AGCT"

# Store binary data
db.put_bytes("meta", b"\x00\x01")
print(db.get_bytes("meta"))  # b"\x00\x01"

# Remove a key
db.delete("seq1")

# Flush and compact
db.flush()

⚖️ API Overview

RocksDB(path: str, compression: Optional[str] = None)

  • Initializes a RocksDB database at the given path.
  • Creates directories automatically if missing.
  • Compression options:
    • "snappy": fast, lightweight
    • Default is "zstd": higher compression ratio

put(key: str, value: str)

Stores a string value under a string key.

get(key: str) -> Optional[str]

Retrieves a string value by key. Returns None if missing.


put_bytes(key: str, value: bytes)

Stores arbitrary binary data under a string key.

get_bytes(key: str) -> Optional[bytes]

Retrieves binary data as bytes. Returns None if missing.


delete(key: str) -> bool

Removes a key (and its value). Returns True on success.


flush() -> bool

Flushes in-memory writes to disk and triggers compaction.

Use this before backups or to minimize storage bloat after bulk writes.


enable_wal() and disable_wal()

Toggles Write-Ahead Logging. By default, WAL is enabled for durability.

Disabling WAL can improve write performance or help avoid data duplication after breaking changes in schema or logic. Use with care—data may be lost on crash.


⚙️ License

Licensed under the Apache License, Version 2.0 (LICENSE).


🔮 Why wrap RocksDB?

This crate was built to expose a minimal and predictable interface to RocksDB for Python projects—particularly for use cases like:

  • Storing FASTA-style header:sequence pairs.
  • Staging byte-encoded ML or bioinformatics data.
  • Quickly dumping + retrieving structured data with compression.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

wrap_rocks-0.6.4-cp313-cp313-manylinux_2_28_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

wrap_rocks-0.6.4-cp312-cp312-manylinux_2_28_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

wrap_rocks-0.6.4-cp311-cp311-manylinux_2_28_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

wrap_rocks-0.6.4-cp310-cp310-manylinux_2_28_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

wrap_rocks-0.6.4-cp39-cp39-manylinux_2_28_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

wrap_rocks-0.6.4-cp38-cp38-manylinux_2_28_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

File details

Details for the file wrap_rocks-0.6.4-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for wrap_rocks-0.6.4-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e2afd17f6bc39bb7a0e0aa8816227735777d3df19c9c70f25a37bf7f5a0a2573
MD5 0c37c8114792a11f2bbd082eb4f4780e
BLAKE2b-256 6b15381ba26b0701f841eaf9a3d6c15f72871a3bdb2056e27e7fb2cfc13d271b

See more details on using hashes here.

File details

Details for the file wrap_rocks-0.6.4-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for wrap_rocks-0.6.4-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 36b99318a4b850aa0c711d6ef63b147753753801f6bf686afcc9166f73791947
MD5 0bcc3dbad80a7de20132990d28174049
BLAKE2b-256 1db485815aaa64c20dea01347c7c943c3a148ef501304daba92384c2ae356fdb

See more details on using hashes here.

File details

Details for the file wrap_rocks-0.6.4-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for wrap_rocks-0.6.4-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 975d1b199e20df068e3f04558e03fde03129d6cc502ff157d4ee4d12b73e2b2a
MD5 be5446bb0495588097cc50ccbf211325
BLAKE2b-256 630c362b7a688790a76e189da3001d96d8c25687846a0a20e4258375739b47b9

See more details on using hashes here.

File details

Details for the file wrap_rocks-0.6.4-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for wrap_rocks-0.6.4-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c661c557500ee419958a2637de5d8b16a046f2e42b5acc8f64742740c21001c1
MD5 bb3210574601d06579b9fdefe45f6799
BLAKE2b-256 cda50474fb3016fcfda9f2dda2794c4a5a7ed15479cee30f98d334aee4499d34

See more details on using hashes here.

File details

Details for the file wrap_rocks-0.6.4-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for wrap_rocks-0.6.4-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e59a1a810a1fcb746f1a0ca0db31bd14440b7c8a6b229b9a60664ce764d2b9a7
MD5 84b0937a2a9d41a64bca1b61d54d8a0c
BLAKE2b-256 58fc079888bb4cede92cd18f543af6a785c81fc68358be3cfc4c1a0d97ba7953

See more details on using hashes here.

File details

Details for the file wrap_rocks-0.6.4-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for wrap_rocks-0.6.4-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de6ee4d884190da86c78eae8385c5ae70b6e5f917d27b4c202d38bab10e03de4
MD5 1eb7dcb46c6115598246b5637e4a1e10
BLAKE2b-256 ae2dead489a54b5f961941b07d985d01c49d9485238febee60f3ec08fc39e577

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page