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.0a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8fae157f654d9754e1d5ec5a1d3fd39d0a1299510758b5aacc1c2309c0cac91 |
|
MD5 | a38a51c6c90f887c4174479fca6a4705 |
|
BLAKE2b-256 | 68f2dffc2f958a4d39f202bb77692f72d2bfad8c81f44f624fae08a06dd71eaf |
Hashes for reddit_experiments-1.0.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d2b7e2c3b3832bbc66b31b4f08b2663f9bbcb9a0c828b42301a5ac2b33fff54 |
|
MD5 | ecbba28cacd6db59a4339ff4ba1bc289 |
|
BLAKE2b-256 | db78cac01bc2c3d652012cfe5fc301fd90d0ce2c5ca86ae569168f1e768fc7e1 |