Skip to main content

Simple toggles for python from a url reference

Project description

LogoMakr_4ojFPZ

Motivation

Simple library to separate deployment of features from release time. It uses network accesible files without the need of a server to provide feature toggles.

Installation

add it to your project using pip install togglee

Usage

from togglee import Togglee

url = "https://gist.githubusercontent.com/kanekotic/c469f99bef5a5c0634b4a94a4acd6546/raw/b67985d8e3a5112c9be2da47bdadf2cf17edbe44/toggles"
refresh_rate_seconds = 5
default_values = [
     {
         "name": "prop",
         "type": "release",
         "value": True
     }
 ]
subject = Togglee(url, refresh_rate_seconds, default_values)
if subject.is_enabled("prop"):
    print("do stuff")
else:
    print("dont do stuff")

Type of toggles

Release

Simple true/false logical path definition.

{
    "type": "release",
    "value": true,
}

Context

Allows complex logic to decide the outcome of the logical path (example traffic, users, resources available).

{
    "type": "context",
    "conditions": [
        {
            "field": "username",
            "value": "user1",
            "operation": "eq"
        }
    ]
}

available operations are:

  • ‘eq’: equal (===)

  • ‘ne’: not equal (!==)

  • ‘gt’: greater than (>)

  • ‘ge’: greater equal (>=)

  • ‘lt’: lesser than (<)

  • ‘le’: lesser qqual (<=)

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

togglee-1.0.48.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

togglee-1.0.48-py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 3

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