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 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.
Metadata
Release files for reddit-experiments 1.14.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| reddit_experiments-1.14.0.tar.gz | 1.4 MB | Without provenance | Details for reddit_experiments-1.14.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| reddit_experiments-1.14.0-py3-none-any.whl | Python 3 | none | any | Details for reddit_experiments-1.14.0-py3-none-any.whl |
Total release size: 1.5 MB
Release files / reddit_experiments-1.14.0.tar.gz
| Download URL | reddit_experiments-1.14.0.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3857f1c83bc5728a13768c5b49798a1369f1123f68a089c3fec2379b2116f3db
|
|
BLAKE2b-256 checksum How to use checksums |
60c5213dcacd711b1d4e19c1d0a73f499a112a6f95501b8688c1999f948b1096
|
| 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.14.0-py3-none-any.whl
| Download URL | reddit_experiments-1.14.0-py3-none-any.whl |
|---|---|
| Size | 39.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f533a1885637d6124b8b4bbdf8589f33e326c659158d2fe3d433df10628c040
|
|
BLAKE2b-256 checksum How to use checksums |
85ef416f91cd9b61f4a0000f4641560a636887b239cf81e7336e5a15a56801e6
|
| 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
|
Security for reddit-experiments 1.14.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.