Skip to main content
glyphhq sends events from Python services, scripts, and data pipelines. It has no dependencies and supports Python 3.9+. The SDK reports its package name and version with each request. Glyph stores this as diagnostic metadata alongside the write key used for ingestion. It is not added to event properties.

Install

Initialize

Keep the write key in an environment variable. Use a glyph_pk_... key in production and a glyph_test_... key while testing the integration. Configuration & delivery lists all options. Python uses snake_case keyword arguments: flush_at, flush_interval_seconds, timeout_seconds, max_retries, api_host, and on_error.

Identify customers with profile

Call profile when a customer signs up or when a profile trait changes. user_id is the stable identity key, and every profile must include email.

Record actions with track

To backfill an event, pass its original time with the timestamp keyword. It accepts a datetime, an ISO 8601 string, or epoch milliseconds:

Record account context with group

group records a group/account event on the customer’s timeline. Glyph does not currently create a separate account record or provide group-level analytics.

Flushing

The Python client is synchronous and has no background thread. It checks whether to flush when a message is enqueued. A flush runs when the queue reaches flush_at (default 20), when flush_interval_seconds (default 5) has elapsed at enqueue time, or when you call flush() or close().
A process that stops enqueuing will not flush on its own. Always call close() (or flush()) before exiting, or use the client as a context manager.

Handle delivery failures

The SDK retries transient delivery failures. Add an on_error callback to log batches that still fail:
Retryable failures leave the batch queued for a later flush. Non-retryable failures, such as a 401 from an invalid write key, call on_error and then drop the batch. See Configuration & delivery.