Python 3.9+ is supported; CI tests 3.9–3.13. From a cloned checkout:
python3.13 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e . -r requirements.txt -r requirements_dev.txtAlternatively, use uv venv --python 3.13 .venv and uv pip install with the
same dependencies. Configure your editor to use .venv/bin/python. Unit tests
need no GrowthBook credentials or running server.
With the virtual environment active, run from the repository root:
pytest -q
mypy
flake8 . --extend-exclude=.venv --count --select=E9,F63,F7,F82 --show-source --statisticsFor typing changes, also run Pyright with the version pinned in CI:
npm install -g pyright@1.1.403
pyright
pytest tests/test_typing.py -qmake test and make type-check wrap pytest and MyPy. make coverage produces
an HTML report. make lint uses older rules and fails on existing style issues;
the flake8 command above matches CI's blocking check.
growthbook/core.pycontains evaluation shared by the syncGrowthBook(growthbook.py) and asyncGrowthBookClient(growthbook_client.py). Test both clients, including loading and refresh when payload handling changes.- Keep library code compatible with Python 3.9 and add type annotations.
Public API changes should include typing regressions in
tests/typing/. - Mock external HTTP calls and close clients created in tests. Async tests use
@pytest.mark.asyncio; async fixtures use@pytest_asyncio.fixture. - Follow the JavaScript reference SDK
for evaluation behavior. Preserve Python-local cases when syncing
tests/cases.jsonwith the shared corpus.
For evaluation or corpus changes, check parity with JS main (requires network):
python tests/scripts/check_corpus_freshness.pyUse --js-source /path/to/cases.json for a local reference. Missing or changed
shared cases fail unless listed with a reason in tests/scripts/corpus_skiplist.json.
For performance changes, compare both checkouts using the same interpreter and machine. Benchmark commands and integration checks are in tests/scripts/README.md.
Discuss public API changes in an issue first. Branch from main, include
regression tests and relevant usage docs, and run the checks above. Describe
behavior changes, compatibility concerns, and validation in the PR.
Use conventional commit subjects (feat:, fix:, etc.); Release Please uses
them to determine versions and changelog entries. Keep the merge or squash
subject consistent with the change.
The Release Please workflow creates a
release PR after changes reach main. Merging that PR creates the tag and
GitHub release, then tests, builds, and publishes the package to PyPI.
setup.py reads the version from growthbook/__init__.py. Contributors normally
leave version and changelog updates to Release Please. The legacy make release
command uploads directly to PyPI; it is not a verification command.
Report vulnerabilities to security@growthbook.io. Follow the Code of Conduct.