Skip to content

A factory for simplekv-Store-based storage classes.

License

Notifications You must be signed in to change notification settings

amerkel2/storefact

 
 

Repository files navigation

https://travis-ci.org/blue-yonder/storefact.svg?branch=master https://coveralls.io/repos/github/blue-yonder/storefact/badge.svg?branch=master Documentation Status

Store factory for simplekv

A factory for simplekv-Store-based storage classes. Takes configuration values and returns a simplekv-Store.

This allows one to easily deploy a blob-based store in production, but test with a filesystem-based store in development. The following simplekv-Stores are supported in storefact:

  • DictStore
  • RedisStore
  • FilesystemStore
  • BotoStore (Amazon S3)
  • AzureBlockBlobStorage

Storefact is released as open source under the 3-clause BSD license.

Installation

pip install storefact

Usage

There are two possibilities to use storefact.

  1. Use a dictionary with configuration data (e.g. loaded from an ini file)
from storefact import get_store

params = {
    'account_name': 'test',
    'account_key': 'XXXsome_azure_account_keyXXX',
    'container': 'my-azure-container',
}
store = get_store('azure', **params)
store.put(u'key', b'value')
assert store.get(u'key') == b'value'
  1. Use an URL to specify the configuration
from storefact import get_store_from_url, get_store

store = get_store_from_url('azure://test:XXXsome_azure_account_keyXXX@my-azure-container')
store.put(u'key', b'value')
assert store.get(u'key') == b'value'

Documentation

The documentation can be found on readthedocs.

Development

To run the all tests run:

tox

About

A factory for simplekv-Store-based storage classes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%