Skip to main content

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.

Metadata

Release files for slowroll 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slowroll 0.0.1
File Size Uploaded
slowroll-0.0.1.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for slowroll 0.0.1
File Interpreter ABI Platform
slowroll-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.5 kB

Release files / slowroll-0.0.1.tar.gz

Download URL slowroll-0.0.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
f929e04f14951568bdf01e13edd56be7de4d020156db49da652e7f376872b367
BLAKE2b-256 checksum
How to use checksums
91823138aab5a69341a3bd4ff49527dae9ffd602b21e7e5b04865e4715a282b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release files / slowroll-0.0.1-py3-none-any.whl

Download URL slowroll-0.0.1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
053cc5bdea7875cb5f33fdcfa18a13192248e1e3bc50dcafca5518a90c36db3a
BLAKE2b-256 checksum
How to use checksums
98833ddc754e778768858867896def02304dc6e24851c3ecebef549a791b7302
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page