RevTurbine SDK for Python — local-mode and HTTP-mode placement and entitlement decisioning
Project description
RevTurbine SDK — Python
Headless, in-memory entitlement and placement decisioning for Python
services. RevTurbineCustomerSdk (plan 33 TASK-7) decides in-process from a
caller-supplied user context + ExportedConfig snapshot — no network, no
persistence beyond memory. Its decision output is byte-identical to the
canonical TypeScript LocalRuntime (cross-language parity is gate-enforced via
revturbine-sdk-internal/tests/parity/).
Full docs: the published Astro docs site — Getting Started → Python SDK
(source: pages-build/src/content/docs/getting-started/python.mdx).
Install
Published as a GitHub Release on revt-eng/revturbine-external (the
customer-accessible repo — there is no PyPI). Requires Python ≥ 3.10.
revturbine-external is private, so fetch the wheel authenticated, then
install the file:
gh release download python-v0.1.0 \
--repo revt-eng/revturbine-external \
--pattern "revturbine-*.whl"
pip install ./revturbine-*.whl
A plain pip install <url> will not work — private-repo release assets
require authentication. (Contributors developing in this repo use the
editable install under Local development instead.)
Quick start
import json
from revturbine import RevTurbineCustomerSdk
with open("playbook.json") as f:
exported_config = json.load(f)
sdk = RevTurbineCustomerSdk(
user_context={"tenant_id": "tenant_abc", "user_id": "user_123", "plan_handle": "pro"},
exported_config=exported_config,
)
if not sdk.check_entitlement("advanced_analytics")["allowed"]:
raise PermissionError("not entitled")
decision = sdk.get_placement_decision(
{"placement_id": "pl_dashboard_upsell", "user_id": "user_123"}
)
Public API
RevTurbineCustomerSdk(*, user_context, exported_config)— keyword-only;user_contextrequirestenant_id+user_id(optionalplan_handle,plan_name,usage). Stateless / in-memory — no storage parameter.check_entitlement(handle, context=None) -> EntitlementCheckResultget_placement_decision(input) -> PlacementDecisionget_placement_decisions(inputs) -> list[PlacementDecision]
That is the entire public surface. Browser/full-SDK concerns (React, hooks,
HTTP/dual-mode, decision cache, segment/targeting derivation,
identify/dismiss/snooze/convert/get_trial_status/capture/…) are
intentionally not ported — plan 33 REQ-14 non-goals.
Project layout
server-python/
├── pyproject.toml ← package metadata + tool config (ruff, mypy, pytest)
├── tox.ini ← test/lint/type matrix
├── .pre-commit-config.yaml ← ruff + mypy hooks (scoped to this dir)
├── src/revturbine/ ← the headless SDK (sdk.py + core/ port)
├── revturbine_server/ ← legacy thin-RPC client (see below)
└── tests/ ← pytest suite (incl. tests/test_public_api.py)
Legacy revturbine_server
A historical thin-RPC HTTP client (from revturbine_server import RevTurbineServer) also ships in this package. It is independent of and
unrelated to RevTurbineCustomerSdk — not folded in, not a dual-mode of it.
It currently depends on an unmaintained generated revturbine.types module
(plan REQ-4 / TASK-2) and is not standalone-importable until that
generator lands. Prefer RevTurbineCustomerSdk for all new server
integrations.
Local development
pip install -e ".[dev]"
pytest # unit + smoke + parity-contract tests
mypy # strict type-check of src/ and tests/
ruff check src tests # lint (CI scope)
ruff format --check src tests
tox # full matrix (py310–py313 + lint + type)
Cross-language parity (run from the SDK repo root):
node scripts/run-parity.mjs # TS + Python runners, byte-diff (the gate)
Dependencies
- Runtime:
pydantic>=2.0. - Stdlib only otherwise. The legacy
revturbine_serverclient uses onlyurllib/json/uuid(plus the unmaintained generated-types import noted above).
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file revturbine-0.2.36.tar.gz.
File metadata
- Download URL: revturbine-0.2.36.tar.gz
- Upload date:
- Size: 164.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a0d7c572c1878d167a21264c408dda011d64665e2bd9d635d7c93661a7d2b2f
|
|
| MD5 |
854161220c289068d0a644438af9b48a
|
|
| BLAKE2b-256 |
4f2f651735ed8e3fb444876e0d72c55512ccd6bcd70e8059f423d89974eddb4f
|
Provenance
The following attestation bundles were made for revturbine-0.2.36.tar.gz:
Publisher:
release-pypi.yml on revt-eng/revturbine-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
revturbine-0.2.36.tar.gz -
Subject digest:
0a0d7c572c1878d167a21264c408dda011d64665e2bd9d635d7c93661a7d2b2f - Sigstore transparency entry: 2228949026
- Sigstore integration time:
-
Permalink:
revt-eng/revturbine-sdk@296fe1140024cb84df870a8a34e0bd27a5ccd714 -
Branch / Tag:
refs/tags/python-v0.2.36 - Owner: https://github.com/revt-eng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@296fe1140024cb84df870a8a34e0bd27a5ccd714 -
Trigger Event:
push
-
Statement type:
File details
Details for the file revturbine-0.2.36-py3-none-any.whl.
File metadata
- Download URL: revturbine-0.2.36-py3-none-any.whl
- Upload date:
- Size: 130.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b3f032371aeaafd19ca1faf27c9fb3660945fa0b113dd72d4b2d2ae8244201c
|
|
| MD5 |
3f41fe2e079c59712979ced413b3be25
|
|
| BLAKE2b-256 |
af322a48442cb1c611d607bf567ce142bb3d1bf570da70aaf897c7f6296178b8
|
Provenance
The following attestation bundles were made for revturbine-0.2.36-py3-none-any.whl:
Publisher:
release-pypi.yml on revt-eng/revturbine-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
revturbine-0.2.36-py3-none-any.whl -
Subject digest:
7b3f032371aeaafd19ca1faf27c9fb3660945fa0b113dd72d4b2d2ae8244201c - Sigstore transparency entry: 2228949229
- Sigstore integration time:
-
Permalink:
revt-eng/revturbine-sdk@296fe1140024cb84df870a8a34e0bd27a5ccd714 -
Branch / Tag:
refs/tags/python-v0.2.36 - Owner: https://github.com/revt-eng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@296fe1140024cb84df870a8a34e0bd27a5ccd714 -
Trigger Event:
push
-
Statement type: