Utilities for randomizing A/B tests
Project description
GetCohorts
Allocate users in your experiments to a cohort using our random, idempotent resource.
curl http://api.getcohorts.com/v1/cohorts \
-X GET \
-d '{"identifier": "user1", "experiment": "homepage-test"}'
The endpoint will randomly assign the user user1
to a cohort for the experiment homepage-test
, and is gauranteed to always assign the same 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 .
To run the webserver, install the Heroku cli.
sudo snap install --clasic heroku
heroku local
The webserver will run on port 8000
.
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.1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aac61f649343c30d1921a9acc65c5865676a7bede64b9d1db30a04a5250d3db4 |
|
MD5 | 9fc197deb8f6fccfec6c883c2fb639f3 |
|
BLAKE2b-256 | be9a1876ac2a2fee7e901f0b3c8db250b58a64d353aee20a3c85c416e0cfc2fa |