Utilities for randomizing A/B tests
Project description
GetCohorts
Allocate users in your experiments to a cohort using our idempotent function.
>>> 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.
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 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
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 getcohorts-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c0ee2e353d9f05d609e7e0d821cb8c1e9605e1c19836fbb310412d00c3b18d4 |
|
MD5 | 2a8aeab351022c6d9d45c53782ebdac1 |
|
BLAKE2b-256 | 99cbc3a160741e056dac9f65eaf7150816d51e669081f87f11414458fc9492b4 |