Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
KeyValueStore
✓ from simplekv import KeyValueStore
Base class for all stores.
RedisStore
✓ from simplekv.contrib.redis import RedisStore
Redis backend store.
S3Store
✓ from simplekv.contrib.s3 import S3Store
Amazon S3 backend store (boto3).
FilesystemStore
✓ from simplekv.fs import FilesystemStore
Local filesystem backend.
MongoStore
✓ from simplekv.contrib.mongo import MongoStore
MongoDB backend.
AzureBlockBlobStore
✓ from simplekv.contrib.azure import AzureBlockBlobStore
Azure Blob Storage backend (since 0.14.0).
Basic usage of RedisStore.
import os
from simplekv.contrib.redis import RedisStore
# Initialize store (assuming Redis running on localhost)
store = RedisStore(host='localhost', port=6379)
# Put a value
store.put('key', b'value')
# Get a value
value = store.get('key')
print(value)
# Delete a value
store.delete('key')
Errors
Common errors & fixes
ImportError: No module named 'simplekv.contrib.redis'
The `redis` extra dependency is missing.
fixInstall simplekv with redis support: `pip install simplekv[redis]`
AttributeError: 'generator' object has no attribute 'sort'
`keys()` now returns a generator instead of a list (since 0.12.0).
fixConvert to list: `list(store.keys()).sort()`
TypeError: can't pickle 'generator' objects
Trying to pickle the result of `keys()` (a generator) in multiprocessing context.
fixConvert to list before passing to other processes: `list(store.keys())`
Upgrade
Version history
0.14.1latest on PyPI · released Apr 9, 2020
Audit
Dependencies
redisoptionalRequired for RedisStore backend when using simplekv[redis]
boto3optionalRequired for S3 backend when using simplekv[s3]
azure-storage-bloboptionalRequired for Azure backend; version 12+ supported since simplekv 0.14.0
pymongooptionalRequired for MongoDB backend when using simplekv[mongo]