Skip to main content

Flypper is a lightweight feature flag package that ships with a WSGI interface.

Project description

Flypper: feature flags, with a GUI

Flypper is a lightweight feature flag package that ships with a WSGI interface.

Installation

Use the package manager pip to install flypper.

pip install flypper

You might want to install one of the following backends instead:

Why

Feature flags can be instrumental to how a team ships software.

I have a hard take delegating such a critical part to a third-party. Also, third-parties tends to grow a bigger feature set than the one I need, to have a per-seat pricing, and to ask for a SSO tax.

Flypper aims at providing a simple feature flag library one could integrate directly to their application as a dependency. The feature set is purposedly small and will require some light work on your side to integrate.

Differences compared to other similar libraries are:

  • A scrappy web UI to manage the flags
  • An architecture aimed at being used on backends and front-ends
  • An efficient caching mecanism to avoid roundtrip to the database

Usage

The library works with 3 components:

  1. A storage backend, storing and retrieving flags in a durable way
  2. A client, acting as an efficient in-memory cache for reading flags
  3. A context, making flags consistents during its lifespan
Components and their roles
storage-client-context

Here is an example:

from redis import Redis

from flypper import Client as Flypper
from flypper_redis.storage.redis import RedisStorage

# Instanciate a *Storage*
redis_storage = RedisStorage(
    redis=Redis(host="localhost", port=6379, db=0),
    prefix="flypper-demo",
)

# Instanciate a *Client*
flypper = Flypper(storage=redis_storage)

# Query flags' statuses within a *Context*
with flypper(segment="professionals") as flags:
    if flags.is_enabled("graceful_degradation"):
        skip_that()
    elif flags.is_enabled("new_feature", user="42"):
        do_the_new_stuff()
    else:
        do_the_old_stuff()

The web UI acts as a client and only needs a storage:

from flypper.wsgi.web_ui import FlypperWebUI

flypper_web_ui = FlypperWebUI(storage=redis_storage)
Web UI
web-ui

The web UI can then be mounted as you see fit, for instance via DispatcherMiddleware.

app = DispatcherMiddleware(app, {"/flypper": flypper_web_ui})

⚠ Careful, you might need to wrap the FlypperWebUI with your own authentication layer, for instance like here.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Work in progress you can contribute to

  • Testing the web UI with pytest and selenium
  • Better support prefixes within the web UI, so redirections work
  • Write tutorials and recipes in the docs/

Upcoming feature ideas

  • Javascript SDK
  • Tracking flags usage efficiently
  • More storage backends

Credits

Inspiration was heavily taken from the following projects.

Many thanks to their authors, maintainers, and contributors.

License

MIT

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

flypper-0.1.7.tar.gz (42.2 kB view details)

Uploaded Source

Built Distribution

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

flypper-0.1.7-py3-none-any.whl (44.9 kB view details)

Uploaded Python 3

File details

Details for the file flypper-0.1.7.tar.gz.

File metadata

  • Download URL: flypper-0.1.7.tar.gz
  • Upload date:
  • Size: 42.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.5 Linux/5.11.0-7633-generic

File hashes

Hashes for flypper-0.1.7.tar.gz
Algorithm Hash digest
SHA256 63a119eda8405be75eea2982f707fc96d58ca6dfa5a64301e9bd9beb074ee721
MD5 89ecae42533e2bd3f1c4dd6f9db91fd9
BLAKE2b-256 1bf023d6bf23424c7b7f6d477de48bf8520043d2f76ff8375455e102bcfb7453

See more details on using hashes here.

File details

Details for the file flypper-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: flypper-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 44.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.5 Linux/5.11.0-7633-generic

File hashes

Hashes for flypper-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9f24fb63a33baf1413ff5a2ec35a66d9eeb0b07bf65104ce35b3082932959bba
MD5 e3d0cf37ec611f751f6c4e4bb9b16a06
BLAKE2b-256 a25abb02e97ce0690913b8bee1eda32580cee1a567e976b1e47a4161538d9682

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