reddit's python experiments framework
Project description
experiments.py
Experiments allow us to determine the impact of changes we make. This library helps you run and track them in Baseplate.py services.
Documentation: https://reddit-experiments.readthedocs.io/
Usage
Install the library:
$ pip install reddit-experiments
Add the client to your application's Baseplate context:
from reddit_decider import decider_client_from_config
decider = decider_client_from_config(
app_config=app_config,
event_logger=ExperimentLogger(),
request_field_extractor=decider_field_extractor,
)
baseplate.add_to_context("decider", decider)
and use it in request:
def my_method(request):
if request.decider.get_variant("foo") == "bar":
pass
See the documentation for more information (documentation builds can be found here) .
Development
A Dockerfile is provided to get a development environment running. To use it, build the base Docker image:
$ docker build -t experiments .
And then fire up the environment and use the provided Makefile targets to do common tasks:
$ docker run -it -v $PWD:/src -w /src experiments
$ make fmt
The following make targets are provided:
fmt
: Apply automatic formatting to the source code.lint
: Run linters on the code.test
: Run the test suite.docs
: Build the docs. Output can be found inbuild/html/
.
Note: some tests are skipped by default locally because they are quite slow.
Enable these by setting CI=true in the environment: CI=true make test
.
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
Hashes for reddit_experiments-1.3.12a4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c04530917aa0a64965be69910e3382326557f95b016c3f163de62f6601c18adc |
|
MD5 | ff51fd35e452742789db7783e34de7f2 |
|
BLAKE2b-256 | 946f3df9a2fee2dcf34d76f33ecc7e09e3cea97fa039bb6a9266f084121119f6 |
Hashes for reddit_experiments-1.3.12a4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce165fc97ab6a350fd75ce777a3bd97c7d1cc12b700051c0b6c2278d84328ab1 |
|
MD5 | 5516675200b9b556aebedcf40055b3f2 |
|
BLAKE2b-256 | 8bd4c90df1634a2c2d42e83bc550b92b9b9335a0172d76a9eb5088e1c9f2317c |