Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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:

# `reddit-v2-events` is a Reddit internal package used for emitting exposure events
$ pip install reddit-experiments reddit-v2-events>=2.8.2

Add the client to your application's Baseplate context:

 from event_utils.v2_event_utils import ExperimentLogger
 from reddit_decider import decider_client_from_config

 decider = decider_client_from_config(
     app_config=app_config,
     event_logger=ExperimentLogger(),
     request_field_extractor=decider_field_extractor,
 )
 baseplate.add_to_context("decider", decider)

and use it in request:

def my_method(request):
   if request.decider.get_variant("foo") == "bar":
       pass

See the documentation for more information (documentation builds can be found here) .

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 in build/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.

Release files for reddit-experiments 1.11.0rc2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reddit-experiments 1.11.0rc2
File Size Uploaded
reddit_experiments-1.11.0rc2.tar.gz 1.4 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for reddit-experiments 1.11.0rc2
File Interpreter ABI Platform
reddit_experiments-1.11.0rc2-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / reddit_experiments-1.11.0rc2.tar.gz

Download URL reddit_experiments-1.11.0rc2.tar.gz
Size 1.4 MB
Tags Source
SHA-256 checksum
How to use checksums
3c35e65ca0b75889d130852c8c0b8b117993f7543818cb21ff0e19f948288283
BLAKE2b-256 checksum
How to use checksums
5eaaeac820b68289222c181c793b9419c05935d0ede007305ba092f4a65707d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.12.1.2 requests/2.32.4 setuptools/47.3.0 requests-toolbelt/1.0.0 tqdm/4.70.1 CPython/3.8.18

Release files / reddit_experiments-1.11.0rc2-py3-none-any.whl

Download URL reddit_experiments-1.11.0rc2-py3-none-any.whl
Size 39.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
527f60d2320bc2630ef927f4377fc3bb904f1296a6313a43da23e520ee7ab036
BLAKE2b-256 checksum
How to use checksums
1b0aa7acb437c844ecacc0de19391f27634f6d3905861d22fd41ed65deb28a9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.12.1.2 requests/2.32.4 setuptools/47.3.0 requests-toolbelt/1.0.0 tqdm/4.70.1 CPython/3.8.18

Release history Release notifications | RSS feed

This release

1.11.0rc2 This release

2 release files

1.10.0

2 release files

1.9.0

2 release files

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.14

2 release files

1.3.13

2 release files

1.3.12

2 release files

1.3.11

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.13

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page