This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Store “live” application settings in a choice of key/value data stores.

This was originally a fork of django-constance, but is now independent of Django and is essentially the key/value abstraction part of the original library.

Backends currently supported: Redis and MongoDB.

Tested with Python 2.7 and Python 3.4.

The source is on github.

Installation

$ pip install waterboy

Usage

In your application, define the settings that you want to be editable:

CONFIG = {
    '<KEY>': <DEFAULT>,
    ...
}

For example:

CONFIG = {
    'INT_VALUE': 1,
    'LONG_VALUE': 100000000,
    'BOOL_VALUE': True,
    'STRING_VALUE': 'Hello world',
    'UNICODE_VALUE': six.u('Rivière-Bonjour'),
    'DECIMAL_VALUE': Decimal('0.1'),
    'DATETIME_VALUE': datetime(2010, 8, 23, 11, 29, 24),
    'FLOAT_VALUE': 3.1415926536,
    'DATE_VALUE': date(2010, 12, 24),
    'TIME_VALUE': time(23, 59, 59),
}

Then create a Config object based on these initial settings. For example, using Redis:

>>> from waterboy import RedisConfig
>>> cfg = RedisConfig(initial=CONFIG)

You then retrieve settings from the backend via attribute-style access:

>>> cfg.INT_VALUE
1

If the backend returns None then the default value is returned.

Similarly, setting an attribute on the Config object will transparently “upsert” (update or insert) that value in the backend.

Attempts to get or set values on the Config object will fail with an AttributeError if the key does not exist in the initial defaults dictionary:

>>> cfg.ABCD = 'abcd'
Traceback (most recent call last):
  ...
AttributeError: 'RedisConfig' object has no attribute 'ABCD'

But this behaviour may be modified by passing strict=False to the Config constructor:

>>> cfg = RedisConfig(initial=CONFIG, strict=False)

which will cause the existence check to be bypassed:

>>> cfg.ABCD = 'abcd'

Development

Clone and run tests:

$ git clone git@github.com:gmflanagan/waterboy.git
$ cd waterboy
$ make test

Tests are run via tox and pytest.

If redis and mongo are not running on the declared ports then the tests associated with those backends will be skipped. See the makefile for the default ports.

To install redis and mongo locally, run buildout:

$ make buildout

Then run redis in the foreground with:

$ make redis

and mongodb with:

$ make mongod

Now run all tests:

$ make test
Release History

Release History

0.1.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
waterboy-0.1.0.tar.gz (15.4 kB) Copy SHA256 Checksum SHA256 Source Aug 8, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting