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.8a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 970f68cb8318e0515731b6ae9cce659c91e198164c499871ff65ff7bb11ed500 |
|
MD5 | 787efd4259453471445c370873aeafad |
|
BLAKE2b-256 | 1752b9710469bb0813831b86f0fbcb152f9596e065f9f982764f72a2d7539605 |
Hashes for reddit_experiments-1.0.8a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c91e151af3b70bcc3b97cef4e07870b13beafb09611ef23800c15f2c3fa41219 |
|
MD5 | 227a034c43da815a67d81564a0a127fc |
|
BLAKE2b-256 | 36385e659f9dac418ce876f9c57dd13d1e647cf2258c0805ff8666293f9c727c |