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.10a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b11d079931c14c7d106fc7683d474f18f77d63563e63d2a6c25a803b1bac2233 |
|
MD5 | 27b193266ab78c59a5d7f39a277c7029 |
|
BLAKE2b-256 | 9f479518ccbfcab380c5ede9edb29552af3bb5d5fddab2fdbce4098ac5afd02b |
Hashes for reddit_experiments-1.0.10a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a2c2d4cc990da6187aa3054b7960c4543ec8ce8d0e2f5794d2de4ff9f3dd906 |
|
MD5 | e5c053f7a39c4ec8e5976b02643c6e4e |
|
BLAKE2b-256 | bdfda7b2617bcba691485b4721f7af42291da19ec180607045b31b2ad2ad3769 |