Skip to main content

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 on PyPI as revturbine. Requires Python ≥ 3.10.

pip install revturbine

Releases are tag-driven and version-locked with @revturbine/sdk — the same version number always ships for both. (Contributors developing in this repo use the editable install under Local development instead. The old GitHub-Release distribution on the now-archived revt-eng/revturbine-external is retired.)

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_context requires tenant_id + user_id (optional plan_handle, plan_name, usage). Stateless / in-memory — no storage parameter.
  • check_entitlement(handle, context=None) -> EntitlementCheckResult
  • can(handle, context=None) — the advertised alias of check_entitlement (same canonical/alias pair as the scaffold SDK function surface and the server-node port)
  • get_placement_decision(input) -> PlacementDecision
  • get_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_server client uses only urllib / json / uuid (plus the unmaintained generated-types import noted above).

Release files for revturbine 0.11.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for revturbine 0.11.4
File Size Uploaded
revturbine-0.11.4.tar.gz 226.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for revturbine 0.11.4
File Interpreter ABI Platform
revturbine-0.11.4-py3-none-any.whl Python 3 none any Details

Total release size: 396.2 kB

Release files / revturbine-0.11.4.tar.gz

Download URL revturbine-0.11.4.tar.gz
Size 226.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e58fc591dab8192529f9be3e1a5019c0611cfd17ba6982c8fe489f0431107606
BLAKE2b-256 checksum
How to use checksums
99d5f2641d0cab3025095812317e930cfeee12bc937e2c3f3e23f8dec4ec8bad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / revturbine-0.11.4-py3-none-any.whl

Download URL revturbine-0.11.4-py3-none-any.whl
Size 169.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86bf87c38d60e1a14b1d41412e30efe36db4bb6ddc80d0687a02393d86708cb5
BLAKE2b-256 checksum
How to use checksums
2d0a94f7636fe13eead188b346efc6516396709ac3e1078b712a0fb5db3db668
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release history Release notifications | RSS feed

0.11.5

2 release files

This release

0.11.4 This release

2 release files

0.11.3

2 release files

0.11.2

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.9

2 release files

0.10.8

2 release files

0.10.7

2 release files

0.10.6

2 release files

0.10.5

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.13

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.91

2 release files

0.2.90

2 release files

0.2.89

2 release files

0.2.88

2 release files

0.2.87

2 release files

0.2.86

2 release files

0.2.85

2 release files

0.2.84

2 release files

0.2.83

2 release files

0.2.82

2 release files

0.2.81

2 release files

0.2.80

2 release files

0.2.79

2 release files

0.2.78

2 release files

0.2.77

2 release files

0.2.76

2 release files

0.2.75

2 release files

0.2.74

2 release files

0.2.73

2 release files

0.2.72

2 release files

0.2.71

2 release files

0.2.70

2 release files

0.2.69

2 release files

0.2.68

2 release files

0.2.67

2 release files

0.2.66

2 release files

0.2.65

2 release files

0.2.64

2 release files

0.2.63

2 release files

0.2.62

2 release files

0.2.61

2 release files

0.2.60

2 release files

0.2.59

2 release files

0.2.58

2 release files

0.2.49

2 release files

0.2.48

2 release files

0.2.47

2 release files

0.2.46

2 release files

0.2.45

2 release files

0.2.44

2 release files

0.2.43

2 release files

0.2.42

2 release files

0.2.41

2 release files

0.2.40

2 release files

0.2.39

2 release files

0.2.38

2 release files

0.2.37

2 release files

0.2.36

2 release files

0.2.35

2 release files

0.2.34

2 release files

0.2.33

2 release files

0.2.32

2 release files

0.2.31

2 release files

0.2.30

2 release files

0.2.29

2 release files

0.2.28

2 release files

0.2.27

2 release files

0.2.26

2 release files

0.2.25

2 release files

0.2.17

2 release files

0.2.16

2 release files

0.2.15

2 release files

0.2.14

2 release files

0.2.13

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page