Skip to main content

Flask feature flag

Project description

Flask feature flag

Tool to activate and deactivate project functionalities

pipeline status coverage report

Package installation

  • Installation
    $ pip3 install flask-feature-flag
    

Configuration

  • Feature flag type availables.

    • FLASK_CONFIG
    • MONGO
  • Define the following to your config.py

    FEATURE_FLAG_TYPE=
    

    FEATURE_FLAG_TYPE is required.

  • You should add this to your config.py if it's feature type FLASK_CONFIG

    FEATURE_FLAGS = {
        'ROUTE_ENABLED': os.environ.get('ROUTE_ENABLED', True)
    }
    

    FEATURE_FLAGS is required.

Docs

Example:

is_enabled this decorator allows to activate or deactivate a functionality and receives as parameters a function to return in case feature is disabled and the name of the feature

from flask import Flask
from flask_caching import Cache
from flask_feature_flag import Flag

config = {
    "DEBUG": True,
    "CACHE_TYPE": "simple",
    "FEATURE_FLAG_TYPE": "MONGO"
}
app = Flask(__name__)
# tell Flask to use the above defined config
app.config.from_mapping(config)
cache = Cache(app)
flag = Flag(app, cache)

def error():
    return dict(massage='this is a mistake')

@flag.is_enabled(error, 'ENV_HELLO')
def hello(name):
    return dict(message=f'Hi, {name}')

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

flask_feature_flag-0.2.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_feature_flag-0.2.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file flask_feature_flag-0.2.1.tar.gz.

File metadata

  • Download URL: flask_feature_flag-0.2.1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for flask_feature_flag-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b3c2090ae527d142cbf3cbaefa4ce7b9285b856e333eea3fd8610132788862cd
MD5 bd01b66a2bf0409a1e945e65138b284b
BLAKE2b-256 7b2c59a27cbb9117624584cfc1babe1cdd6cd52d849013e74c172ce810a989a1

See more details on using hashes here.

File details

Details for the file flask_feature_flag-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: flask_feature_flag-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for flask_feature_flag-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f921c51e30d64e0cdd07ae8d57959a9f7bc8e93fadc343ddb4164d7d719461b0
MD5 bff93bb3ed2af4c929902c106a65e18f
BLAKE2b-256 bb1e052d3ce9847bb7506110023313c0e7566bababe8202505af6eebee1d4644

See more details on using hashes here.

Supported by

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