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.5-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.5-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.5-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.5-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.5-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.5-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.5-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for wrap_rocks-0.6.5-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 485ddb1481f3e4b2ada67e63db82584d0d6dfc86ccf07c0be94c7c6e4bd681bf
MD5 b2ec53df3d861040f21e99a938582f70
BLAKE2b-256 c924d96b41856d26faea03bfd48ca99834a5fff7161420f67d910f8b95e1c0da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wrap_rocks-0.6.5-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 21a1a2748db3d12e59b2b31b56e96eb8dc530cfe2025b5772b2e56d7b0d1a4f3
MD5 9ba8a24f841cfbd7e186896c555349b4
BLAKE2b-256 bf9af164d892496e46a738dd4e97baf7d432e0bb8a0294a4acbe7ffa3e3b1363

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wrap_rocks-0.6.5-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 754d3ac4846ac8047947c7a77687768db2cd4d9f42dfd5c361b13592a19ade2a
MD5 6f82d9850534302a2a31c990dcccffd2
BLAKE2b-256 4f6d577f535e4a96652504e4f662b955ed1de1e51eb4d61b3126607a8f96d61b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wrap_rocks-0.6.5-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 267e2e8b41768b409930d2c5fecb2ade0ff2141cc4a0e5498b5d1739e1ddc2ec
MD5 5bfc29ccb4bdc8679351f95d80ffeddd
BLAKE2b-256 52af6584ea4145a5f53fc792c000a7ef452f9b83607943023e02028b91f50418

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wrap_rocks-0.6.5-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 50022c91e4a7562e66935d9354f8a71e34e7218beb818cf58508295f0337e937
MD5 b2185dff7c708c1e4033a7d447f7d47e
BLAKE2b-256 ffd3de70cddb7a63d23fa13e1c17cb0c4739a1d1181a6a57beef53b6bfd9cdfb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for wrap_rocks-0.6.5-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 33c75d1c2ad0a2336e2512b39c86af2b59a39282c9e2e2874de6329011359c48
MD5 6250c681ae6af341498bcefe0f13f0e4
BLAKE2b-256 adf8fe50b95750356372b3a0b950ce3c0844dc0a4b77e70877f9f5642db00525

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