Skip to main content

Feature flipper for Pyramid, Pylons, or TurboGears apps.

Project description

Build Status Code Coverage

Switchboard

Switchboard is a Python WSGI app that makes it easy to toggle features in a variety of Python web frameworks. Created to enable A/B and user testing at SourceForge, it features an easy-to-use admin dashboard with powerful conditions for activating a particular feature.

Admin Dashboard

What follows is an abbreviated version of Switchboard's full documentation.

Getting Started

Want to use Switchboard in your application? Keep reading. Interested in developing on Switchboard or running a small example locally? Take a look at the Development section.

Installing

Install Switchboard and its dependencies using pip:

pip install switchboard

Setup

Next, embed Switchboard and its admin UI within the application. Framework-specific details can be found in Switchboard's documentation.

Using Switches

Switchboard's basic unit is a switch. Every switch has a unique key associated with it and is either active (on) or inactive (off), so using it in code is simple:

>>> from switchboard import operator
>>> operator.is_active('foo')
False

In this case we checked to see if the "foo" switch was active. By default, Switchboard will auto-create any switches that don't already exist, such as "foo". Auto-created switches default to an inactive state. This just scratches the surface; there's so much more that a switch can do.

Development

These instructions cover setting Switchboard up locally for development and testing purposes. See Getting Started for notes on how to use Switchboard within a web application.

Prerequisites

  • Virtualenv: $ sudo easy_install virtualenv

Bootstrapping

  1. Make a virtualenv workspace: $ virtualenv --no-site-packages .venv
  2. Activate the virtualenv: $ source .venv/bin/activate
  3. Install all dependencies: $ make install

Running the Example App

Switchboard includes an example application, which is handy both for doing development and for taking it for a test drive in a very simple environment. It also provides an example of setting Switchboard up to run within a Bottle-based application.

To run:

$ make example

At this point a very simple application is now running at http://localhost:8080 and the admin UI is accessible at http://localhost:8080/_switchboard/. The application has one switch (example) and outputs text that tells you whether the switch is active.

Running Tests

Switchboard includes both unit tests and functional tests of the admin dashboard, using the example application.

To run the unit tests:

$ make test

The functional test requires both an updated Firefox and geckodriver:

$ npm install -g geckodriver

To run the functional tests:

$ make functional-test

Releasing

To distribute a new release of Switchboard:

  1. Update the version in setup.py, following Semantic Versioning.
  2. Cut the release:
$ make release

Versioning

We use Semantic Versioning for versioning. For the versions available, see the tags on this repository.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the Apache License - see the LICENSE file for details.

Acknowledgments

Switchboard began life as a port of Disqus' Gargoyle, a feature flipper for Django. David Cramer's Pycon lightning talk on Gargoyle had me drooling for that same feature flipping fun in non-Django apps.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

switchboard-1.6.3.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

switchboard-1.6.3-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

Details for the file switchboard-1.6.3.tar.gz.

File metadata

  • Download URL: switchboard-1.6.3.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.10

File hashes

Hashes for switchboard-1.6.3.tar.gz
Algorithm Hash digest
SHA256 021ab77be70f1645e53b10c3149809b092aed7e739572f3dd998f6ee9ad3c7ff
MD5 6a6c4b1e1ce3223e86c232755b4e5379
BLAKE2b-256 a4e0f126b5da568592685456e5bba0ad5a6f0419b1341bd675bc77dcf4ead5ff

See more details on using hashes here.

File details

Details for the file switchboard-1.6.3-py3-none-any.whl.

File metadata

  • Download URL: switchboard-1.6.3-py3-none-any.whl
  • Upload date:
  • Size: 59.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.10

File hashes

Hashes for switchboard-1.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b4532d42ead0a3b4e93719343b1842d87bdcfa4bad99241601ce29f13f6612a
MD5 00d1d74eec62c1e057821e9be68e9d5d
BLAKE2b-256 84658cddcab74c2441cf30d91d5b67d9196dac52de36187455c91632846dd1d3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page