Apphelm Python SDK
The official Python client for Apphelm, for server-side code: product events, identify, fail-closed feature flags, error and message reporting, cron check-ins and tracing. One module, standard library only, Python 3.10 or later.
pip install apphelm
Use a server API key (ahl_…) from your Apphelm workspace and keep it secret. Never ship it in
a browser or mobile app.
import os
from apphelm import Apphelm
apphelm = Apphelm(api_key=os.environ["APPHELM_API_KEY"])
# A product event for one person.
apphelm.capture("org_…", "prd_…", distinct_id=customer.id, event_name="invoice_sent")
# Feature flags fail closed: any network, timeout or API error evaluates to False.
if apphelm.is_enabled("new-checkout", customer.id, product_id="prd_…"):
render_new_checkout()
variant = apphelm.get_feature_flag("org_…", "prd_…", "pricing-test", customer.id) # variant, True or False
Identify
Every trait needs provenance. A trait without a matching trait_sources entry raises
ValueError before anything is sent, because the API would reject it.
apphelm.identify("org_…", "prd_…", external_user_id=account.id,
traits={"plan": "builder"},
trait_sources={"plan": {"sourceType": "auth", "sourceId": "session", "verification": "integration_verified"}})
Errors and messages
try:
charge(order)
except Exception as error:
apphelm.capture_exception("org_…", "prd_…", error, release=os.environ.get("RELEASE"),
environment="production", tags={"route": "/charges"}, user_id=account.id)
# Report uncaught exceptions (main thread and other threads) as unhandled issues.
# The previous hooks still run, so the traceback prints and the process exits as before.
restore = apphelm.capture_unhandled("org_…", "prd_…", release=os.environ.get("RELEASE"), environment="production")
apphelm.capture_message("org_…", "prd_…", "Payment provider fell back to retries", level="warning")
Tracebacks are scrubbed of email addresses, keys and query strings before they are sent, and
user_id is sent only as a hash. Pass before_send= to the constructor to change or drop
exceptions and messages: return the properties (changed or not), or None to drop the event. A
hook that raises drops the event.
Tracing
# Continue the caller's trace (from the browser or another service), or start a new one.
with apphelm.start_transaction("org_…", "prd_…", "POST /charges", traceparent=request.headers.get("traceparent")) as tx:
with tx.start_span("db.query", "select order"):
...
Apphelm(api_key, traces_sample_rate=0.2) keeps a share of new transactions; a transaction that
continues an incoming traceparent keeps the caller's sampling decision.
Cron check-ins
apphelm.check_in("prd_…", monitor="nightly-export", status="ok", duration_ms=5400)
Errors from the client
Failed requests raise ApphelmError with status and code. Flag checks (is_enabled,
get_feature_flag) never raise for a failed request; they return False.
Licence
Proprietary. See LICENSE: use requires an active Apphelm service agreement.
Releasing this package: docs/SDK-RELEASING.md in the Apphelm repository.
Metadata
Release files for apphelm 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| apphelm-0.5.1.tar.gz | 12.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| apphelm-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.9 kB
Release files / apphelm-0.5.1.tar.gz
| Download URL | apphelm-0.5.1.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7fd33bf865a0ecb59b4b6d0ce6ccf239ac9536a0a6aa543529be197550bd0a0
|
|
BLAKE2b-256 checksum How to use checksums |
be4b5cc88f3ad8b7bc37388849e9fcea0a90dc884ab47193b30e998065613fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Release files / apphelm-0.5.1-py3-none-any.whl
| Download URL | apphelm-0.5.1-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d2355340a276f6b740e50475832301e65ffd9dc87b4e1bc7d26670154c7ea8d6
|
|
BLAKE2b-256 checksum How to use checksums |
4e2323af3a9984eee2f1239a672bbc2863408e584245d843ffc101c3fb731a22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.9
|
Security for apphelm 0.5.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.