Simple toggles for python from a url reference
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file togglee-1.0.48.tar.gz
.
File metadata
- Download URL: togglee-1.0.48.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 302ab0d8c8d26d19589032a7d6ad6b7ef914feed5633e1f4473dce5a93899cce |
|
MD5 | d2a5c9d64383ba184616d13acba91eb0 |
|
BLAKE2b-256 | db39d5efcf22b45dad62d041d91e4b9abe1bc102a51f34f1cfbade0873e788c3 |
File details
Details for the file togglee-1.0.48-py3-none-any.whl
.
File metadata
- Download URL: togglee-1.0.48-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fd9bc52db305b172bde99cd74f489cda1d7a32975a3c714d67c5ed7b1043d53 |
|
MD5 | a909640e294cb7fa584bef7dd5db2808 |
|
BLAKE2b-256 | 021e46949770ec5179457364754b84f77a4a37519086f862459fde9905254e55 |