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:
baseplate.configure_context(
{
...
"experiments": ExperimentsClient(event_logger),
...
}
)
and use it in request:
def my_method(request):
if request.experiments.variant("foo") == "bar":
pass
See the documentation for more information.
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.0.9a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44b01d0b60d02b1c48a638911fd6dd9f2e92aa748b3e918ceabcf1188869c08e |
|
MD5 | 88d3e97d5a4fc45f6e881b9562bea8ee |
|
BLAKE2b-256 | 69bb955b178c89c13112a4a4a727dee863bd66cd24f6d1793c25922fedf5337d |
Hashes for reddit_experiments-1.0.9a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f919951bfa80ce1ff1cbbd3781682ec99b11a15bef5c49e9322a00fae27dcc98 |
|
MD5 | c4acdcc8dd445d0c224cb659100a14bc |
|
BLAKE2b-256 | 332f29f0affb562810dc8193cfbd2ba5942665f333b5293f85c9cebca1ced6e0 |