The existing three LevelDB interfaces (py-leveldb, cpy-leveldb, plyvel) use the Python C API and compile Python modules that work with LevelDB's C++ interface. This Python module simply uses the ctypes library to LevelDB's C interface - making it more portable across Python implementations and easier to install and distribute.
leveldb-py:
- supports get/put/delete (with standard read/write options)
- supports bloom filters
- supports leveldb LRU cache
- allows for manual or automatic database closing (compare with py-leveldb)
- provides write batches
- provides iterators (full control of leveldb iteration, with additional idiomatic python iterator support)
- provides prefix-based iteration (returns iterators that work as if all keys with a shared prefix had the prefix stripped and were dumped into their own database)
- provides scoped sub-databases (presents a new database wrapper backed by an existing database with all keys prefixed by some prefix)
- provides range iterators (for idioms like give me all keys between start and end)
- provides an in-memory db implementation (for faster unit tests)
- supports snapshots
- fits in one file
- requires no compilation
import leveldb
db = leveldb.DB("/path/to/db", create_if_missing=True)
db.put("key", "value")
print db.get("key")
for key, value in db:
print key, value