Metadata-Version: 2.1
Name: getcohorts
Version: 0.0.5
Summary: Utilities for randomizing A/B tests
Home-page: http://docs.getcohorts.com/
Author: Tom Waterman
Author-email: tjwaterman99@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown

# GetCohorts

Allocate users in your experiments to a cohort using our idempotent function.

```python
>>> from getcohorts import get_cohort
>>> get_cohort(b'user123', b'experiment', cohorts=['experimental', 'control'])
'experimental'

```

Using `get_cohort` will randomly assign a user to a cohort, but always assigns that user to the same cohort for the same `experiment`.

## Development

Clone this repo.

```bash
git clone https://github.com/tjwaterman99/getcohorts.git
```

Install the package's dependencies, and install `getcohorts` in editable mode.

```
pip install -r requirements.txt
pip install --editable .
```

### Testing

Run the tests with pytest

```
pytest
```

You can run the github CI workflows locally if you have [act](https://github.com/nektos/act) installed. You'll also need to create a file `.secrets` that contains deployment secrets for the staging environments.

```
# .secrets
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
DOCS_S3_BUCKET=...

PYPI_USERNAME=...
PYPI_REPOSITORY_URL=...
PYPI_ACCESS_TOKEN=...
```

Then run the Github workflows.

```
sudo act --secret-file .secrets
```

### Documentation

Build the docs with sphinx-autobuild. The site is available at `0.0.0.0:8000`.

```
sphinx-autobuild docs docs/_build
```


