Skip to main content

Feature flipper for Pyramid, Pylons, or TurboGears apps.

Project description

https://travis-ci.org/switchboardpy/switchboard.svg?branch=master

Switchboard is a port of Gargoyle, a feature flipper for Django apps, to the Pyramid or Pylons stack (including TurboGears). Originally used to selectively roll out changes to the SourceForge site, the library lets you easily control whether a particular change (a switch) is active.

You can make switches active for a certain percentage of visitors, all visitors to a particular host in a cluster, or if a particular string is present in the query string. Furthermore you can easily create your own conditions to do fancier things like geo-targeting, specific users, etc. In short, Switchboard turns you into a continuous deployment ninja.

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.

Whether a switch is active or not is controlled by two attributes: status and condition sets. There are four different statuses:

  • Inactive - disabled for everyone

  • Selective - active only for matched conditions

  • Inherit - inherit from the parent switch

  • Global - active for everyone

Inactive and global are opposite extremes: the switch is turned on or off for everyone. The full docs cover parent-child switches, which involves the inherit status. The selective status involves the second attribute, condition sets. When a switch is in seletive status, Switchboard checks the condition sets on the switch to see if it should be active. Conditions are criteria such as “10% of all visitors” or “only logged in users” that can be applied to the request to see if the switch should be active. When a switch is in selective status, it will only be active if it meets the conditions in place.

Switchboard’s switches and their condition sets are controlled via the admin UI. Adding switches to your code is as easy as importing the global operator object, as demonstrated above. While there is much more to Switchboard, such as parent-child switches, creating your own conditoion sets, and setting up default settings for certain types of switches, the quick intro above should give you a taste of what it’s capable of doing.

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.3.1.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

switchboard-1.3.1-py2-none-any.whl (34.8 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: switchboard-1.3.1.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for switchboard-1.3.1.tar.gz
Algorithm Hash digest
SHA256 6009144e92ed09b6597c9ef3561fbb2939d529f27da625dfc5a201b86770aad0
MD5 8a2abdccd1173296aab6a2795c9142b9
BLAKE2b-256 8757865c8b35addf9292e3f6411cda2d628aeeeba1b7521a4bf87195559ec5de

See more details on using hashes here.

File details

Details for the file switchboard-1.3.1-py2-none-any.whl.

File metadata

File hashes

Hashes for switchboard-1.3.1-py2-none-any.whl
Algorithm Hash digest
SHA256 22ee439b2d2b862ba9867112b626e1b39a37eab9dd5910c81ef0092db85f972e
MD5 a4ad5bbbde243e8f3ae6e63ea3ed7c86
BLAKE2b-256 dc79be88b1789e9f5c1608ed29c49ecbd6eb2ad474abf75aa2a8eac825f95815

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