Vibeleaderboard
Index / tool
Visit posthog.com
Category
Developer Tools
Rank
Pricing
Open Source
Type
TOOL
Builder
PostHog
GitHub
61 stars
Latest release
posthog-v7.47.3
Date

About

Official PostHog SDK for sending product usage events from Python applications.

What it does

PostHog Python connects application behavior to PostHog while also handling identity, groups, feature flags, contextual tags, exception capture, and AI instrumentation. It can evaluate flags remotely or from locally refreshed definitions, then attach the exact evaluation snapshot to later events. Background queues batch outgoing traffic, while synchronous operation remains available.

Why it's ranked here

This is a substantial application client, not a thin event wrapper. Its strongest case is breadth combined with operational care: separate traffic lanes, bounded flag retries, connection management, local flag evaluation, explicit result types, privacy controls, and event filtering. The repository also maintains framework and OpenFeature documentation, although practical examples live outside the package README.

What's good

Feature flags receive unusually careful treatment. Results can include variants, payloads, reasons, metadata, and exact evaluation snapshots, reducing disagreement between application branching and recorded events. Event delivery supports batching, compression, retries, queue limits, and separate analytics and AI traffic. Context scopes propagate identity, sessions, device identifiers, and tags. Exception capture includes configurable secret masking and variable filtering.

Tradeoffs

Current releases require Python 3.10 or newer. The README deliberately sends readers to external documentation, so the repository alone offers limited onboarding beyond one large interactive example. Local flag evaluation needs a secret credential and refreshed definitions. Remote evaluation still introduces network behavior. Optional AI, telemetry, compression, and framework integrations expand the dependency and configuration surface.

How to use it well

Choose it for Python services that already use PostHog and need analytics, feature decisions, error capture, or AI telemetry under one client. Prefer explicit client instances, scoped context, and saved flag evaluation snapshots. Configure queueing, retries, privacy, and shutdown behavior deliberately. It does not replace the PostHog analytics service or serve as a general observability backend.

Technical notes+

pyproject.toml defines a setuptools package requiring Python 3.10+, core dependencies on requests, backoff, distro, and typing-extensions, plus optional LangChain, Zstandard, and OpenTelemetry groups. posthog/client.py implements distinct analytics and AI queue lanes, background consumers, synchronous capture, context propagation, exception handling, and local or remote flag evaluation. posthog/request.py provides pooled requests sessions, configurable socket options, bounded flag retries, gzip support, host normalization, and fork-safe session resets. posthog/types.py normalizes legacy and current flag responses into typed frozen dataclasses. posthog/utils.py contains serialization and in-memory or Redis-backed flag caches. Tests are packaged under posthog.test and configured through pyproject.toml.

Observed

License
MIT
Primary language
Python
Packaging
PyPI library package named posthog, built with setuptools and wheel
Interface
Importable Python library with module-level and explicit client APIs
Python support
Requires Python 3.10 or newer
Platform support
Classified as operating-system independent
Core dependencies
requests, backoff, distro, and typing-extensions
Repository structure
Tests live inside the posthog package and use pytest

Read from README.md, Makefile, setup.py, pyproject.toml, example.py, setup_analytics.py, posthog/args.py, posthog/types.py, posthog/utils.py, posthog/client.py, posthog/poller.py, posthog/request.py, posthog/version.py, posthog/__init__.py, posthog/_logging.py.

What it can do

  • Send product usage events to PostHog

    Event data and user properties from Python applicationEvents tracked in PostHog analytics platform

  • Track user actions and behaviors

    User interaction data and event parametersBehavioral analytics data in PostHog dashboard

  • Identify and associate events with users

    User identifier and event propertiesUser-linked event data for analysis

  • Capture feature flag evaluations

    Feature flag keys and user contextFeature usage analytics and A/B testing data

  • Set user properties and attributes

    User identifier and property dataUpdated user profiles in PostHog

  • Group users into cohorts or organizations

    Group identifier and user associationsGrouped user data for segmented analytics

Tags

posthogsdkpythonanalytics

Tech Stack

Python

Media

PostHog Python

Comments (0)

No comments yet

Editorially curated, with community endorsements as a secondary signal. Corrections welcome.