Metadata-Version: 2.1
Name: reddit-experiments
Version: 1.3.4
Summary: reddit's python experiments framework
Home-page: https://github.com/reddit/experiments.py
Author: reddit
License: BSD
Project-URL: Documentation, https://reddit-experiments.readthedocs.io/
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: baseplate (<3.0,>=2.0.0a1)
Requires-Dist: reddit-edgecontext (<2.0,>=1.0.0a3)
Requires-Dist: reddit-decider (>=1.2.2)

# 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:

```console
$ pip install reddit-experiments
```

Add the client to your application's Baseplate context:

```python
baseplate.configure_context(
  {
     ...
     "experiments": ExperimentsClient(event_logger),
     ...
  }
)
```

and use it in request:

```python
def my_method(request):
   if request.experiments.variant("foo") == "bar":
       pass
```

See [the documentation] for more information.

[the documentation]: https://reddit-experiments.readthedocs.io/

## Development

A Dockerfile is provided to get a development environment running. To use it,
build the base Docker image:

```console
$ docker build -t experiments .
```

And then fire up the environment and use the provided Makefile targets to do
common tasks:

```console
$ 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`.


