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.13a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ff5a39b278c83283388a879a17489c52890ca0e2209b4b084f69e7d07b7020e |
|
MD5 | e31efe443a6bfd5ae9ebc0918ab7e430 |
|
BLAKE2b-256 | bec3961c03156336c2e4f42ad8886a2f51d39e085e19288c7ca0c525c08ac410 |
Hashes for reddit_experiments-1.0.13a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 403ae860511ef3a7f7a2e804ab46471ab1ec5488382c40f40bd091c289661b9c |
|
MD5 | 2b514da3e3896098685fc88f5fe05b32 |
|
BLAKE2b-256 | 85edf96d0405eceff896780f92d6f71ceca37386689c747c8308f27c7453073b |