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.11a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78727d36501f10e5f5da8cbb02054a1d6d0d1aeffa373fd25630c9b9255ab63d |
|
MD5 | f3554d472487d90df0b2f4fb2f5609dc |
|
BLAKE2b-256 | 62fe53aaba9eff5de13d33b3bba6356a416bf9700a6f56f7f49a2dcd7a3c88c4 |
Hashes for reddit_experiments-1.0.11a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f69b1349c2c0a565b2040b7dd272f4ad8305ef814820089188e8ff31a4204da |
|
MD5 | edeb455afbd768866736b150e0399438 |
|
BLAKE2b-256 | 3b2909a4bfc2d3e277a80c0451f2fbf0e73b643d89d144b6bafd5a9e30a37810 |