Skip to main content

Configuration slowly applied to clients over time

Project description

slowroll

Let's say you want to roll out a feature flag, or something that selects a canary version. Put a json config up somewhere, decide how you're hashing your users, and use SlowrollConfig:

from slowroll import SlowrollConfig

sc = SlowrollConfig("https://example.com/config.json", "app_features")
if sc.get_value("features", "install_to_opt_foo", socket.gethostname()):
    ...

The config for this would look like

{
    "features": {
        "install_to_opt_foo": {
            "end_time": "2025-01-01 00:00Z",
            "duration": "14d",
            "stable": false,
            "new": true,
            "early_adopters": ["canary-host"],
        }
    }
}

Note that the values for "stable" and "new" can be any valid json. Here they are bools, but could just as easily be strings that represent versions of a Python project. start_time is not explicitly specified, but calculated from the duration.

There are few restrictions on the http server, namely that it must provide etags using the default implementation, but you can provide your own that takes an opaque url and an opaque value that you can use to store any etag-esque metadata.

As in semver, expect no compatibility guarantees until this reaches 1.0. Both the API and config format are expected to change.

Extensibility

  • What if I want to store the config in zookeeper? Sure, provide a custom callback that returns the latest version you know of.

Future Work

  • Ability to locally lock a value (either old or new)
  • Example using a requests session
  • Retries/fallback
  • More testing on _pct values
  • Config validator
  • Interpolation of numeric values
  • Regex early_adopters
  • Rollbacks that count down

License

slowroll is copyright Tim Hatch, and licensed under the MIT license. I am providing code in this repository to you under an open source license. This is my personal repository; the license you receive to my code is from me and not from my employer. See the LICENSE file for details.

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

slowroll-0.0.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

slowroll-0.0.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file slowroll-0.0.1.tar.gz.

File metadata

  • Download URL: slowroll-0.0.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for slowroll-0.0.1.tar.gz
Algorithm Hash digest
SHA256 f929e04f14951568bdf01e13edd56be7de4d020156db49da652e7f376872b367
MD5 ca9427b66c40bab600c6b9debc09b31e
BLAKE2b-256 91823138aab5a69341a3bd4ff49527dae9ffd602b21e7e5b04865e4715a282b7

See more details on using hashes here.

File details

Details for the file slowroll-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: slowroll-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for slowroll-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 053cc5bdea7875cb5f33fdcfa18a13192248e1e3bc50dcafca5518a90c36db3a
MD5 a118f42fadae0a478be36d76b0a6de50
BLAKE2b-256 98833ddc754e778768858867896def02304dc6e24851c3ecebef549a791b7302

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