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.7a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 304771ea21fee4a5e4af491bbc248125db027488723b68f68144a24338e7e694 |
|
MD5 | 2bcd97e472d9c0476487cae43affd176 |
|
BLAKE2b-256 | c7dc6ab578824c583fd06e6404bcfe0192a48308966858981ec8582c4071f4a9 |
Hashes for reddit_experiments-1.0.7a0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4fe4c8575c268896d911e4c030c4b3b8069ab54c7ce17f6574905064decad4e9 |
|
MD5 | b0ef00451a3d5edf0b03eea1f523d4d0 |
|
BLAKE2b-256 | 5bc6e3e5a9d7e62d26da75f73bdb4d899e4a2512de7859c894b263787897fde9 |