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

django-sixpack is a Django-friendly wrapper for the sixpack-py client library to SeatGeek’s Sixpack, a language-agnostic A/B testing framework.

This is not a full-fledged client (it relies on sixpack-py for the actual connection); it’s a wrapper to make using sixpack-py more friendly and declarative.

Install

pip install django-sixpack

Configuration

Set SIXPACK_HOST and (optionally) SIXPACK_TIMEOUT in your settings file.

If SIXPACK_HOST is unset, it will fall back to sixpack-py’s default, which is http://localhost:5000. If SIXPACK_HOST is set to None, django-sixpack will operate in test mode, which means that the control alternative (the first one listed) will be returned for all participate calls, all convert calls will be successful, and the exertnal sixpack server will not be contacted.

Usage

First, define a test somewhere:

from djsixpack.djsixpack import SixpackTest

class ButtonColorTest(SixpackTest):
   alternatives = (
      'RED',
      'BLUE'
   )

If you go into the Sixpack web dashboard, you’ll see this as a test called button_color, with the control being the alternative RED (the first alternative listed will be considered the control).

When it’s time to add a user to the test:

expt = ButtonColorTest(request.user)
bucket = expt.participate()

context = {}
if bucket == ButtonColorTest.RED:
   context = {'color': '#FF0000'}
elif bucket == ButtonColorTest.BLUE:
   context = {'color': '#0000FF'}

SixpackTest.participate will return the alternative request.user is bucketed into - and all alternatives will be available as class properties.

When instantiating a SixpackTest test, the only argument the constructor takes is the model instance which is used to represent the person seeing this test. By default, SixpackTest will use the instance’s pk attribute as the unique identifier to represent this person - but this can be overridden by setting the unique_attr class attribute.

For example, you could have a Business model class which represents a person, and it has a attribute called global_id which represents a cross-platform way of identifying a particular Business. In that case, you could do:

from djsixpack.djsixpack import SixpackTest

class ButtonColorTest(SixpackTest):
   unique_attr = 'global_id'
   alternatives = (
      'RED',
      'BLUE'
   )

At any point, you can check the SixpackTest.client_id property to see what’s being used as the client_id.

If something ever goes wrong - a request times out, the sixpack server disappears, etc. - all participate calls will return the control alternative, and all convert calls will seem successful (and we’ll note this happend in the log).

Suported Versions

django-sixpack will work with all version of Django >= 1.4, however the test suite requires Django >= 1.6.

License

django-sixpack is released under the MIT license.

Contribute

  • Check for open issues or open a fresh issue to start a discussion around a feature idea or a bug
  • Fork the repository on GitHub to start making your changes to the master branch (or branch off of it)
  • Send a pull request and bug the maintainer until it gets merged and published
  • Add yourself to the AUTHORS file

Thanks

Release History

Release History

1.0.5

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

1.0.4

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

1.0.3

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
django-sixpack-1.0.5.tar.gz (6.0 kB) Copy SHA256 Checksum SHA256 Source Dec 18, 2014

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