posthog

The official PostHog SDK for sending events, feature flags, and session data from any Python application.

SDK
PyPI
v7.75.11
62 stars
Custom / Unknown

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
82 /100 Excellent
Development Activity 100
Maintenance 100
Community 56
Maturity 60
Momentum 12

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
78 /100 Good
Architecture 80
Code Quality 82
Innovation 70
Learning Curve 80

posthog-python is the official Python client for PostHog, the open-source product analytics platform. It provides a simple API for capturing events, identifying users, evaluating feature flags, and recording session data, batching and sending them to a PostHog instance (cloud or self-hosted).

The SDK includes framework-specific integration guides for Django and Flask, an OpenFeature provider for standardized feature-flag evaluation, and optional LangChain integration for tracking LLM application usage. It supports Python 3.10 through 3.14 and ships as a production-stable package maintained directly by the PostHog team.

What You Get

  • A simple capture() API for sending custom events and user properties to PostHog
  • Feature flag evaluation, including local evaluation for low-latency flag checks
  • An OpenFeature provider for standardized feature-flag access via the OpenFeature Python SDK
  • Built-in integration guides and helpers for Django and Flask applications
  • Optional LangChain integration for tracking LLM application usage and costs
  • Automatic batching and asynchronous delivery of events to reduce application-side latency

Common Use Cases

  • Instrumenting a Python backend to send product analytics events to a PostHog project
  • Evaluating feature flags server-side to control rollout of new functionality
  • Tracking LLM application usage and cost metrics via the LangChain integration
  • Using OpenFeature-standard flag evaluation with PostHog as the backing provider

Under The Hood

Architecture - The posthog/ package (147 Python files) organizes functionality into a core client, a feature-flags evaluation module supporting both remote and local flag evaluation, and dedicated integration modules for Django, Flask, LangChain, and OpenFeature; a separate openfeature-provider/ directory implements the OpenFeature spec adapter, and sdk_compliance_adapter/ supports cross-SDK compliance testing shared across PostHog’s client libraries. Tech Stack - Pure Python (3.10-3.14) using requests for HTTP delivery, backoff for retry logic, distro for OS/platform detection, and typing-extensions for backward-compatible type hints; optional extras include langchain for LLM tracking and an opt-in zstd compression extra for request payload compression. Code Quality - The repository includes 78 test files covering unit and integration scenarios (integration_tests/), a mypy-baseline.txt for gradual type-checking adoption, and an e2e_test.sh script for end-to-end validation against a live PostHog instance; commit activity is very high (86 commits/month) reflecting active maintenance by the PostHog team. API Design - The client exposes a minimal posthog.capture()/posthog.identify() surface that mirrors PostHog’s other language SDKs for consistency, while advanced use cases (local flag evaluation, OpenFeature, LangChain) are opt-in via separate imports/extras, keeping the default install lightweight; official docs at posthog.com/docs/libraries/python provide framework-specific quick starts.

Used by 19 apps in this directory

Python
94%
Apache 2.0

knowhere

AI Development · AI Memory · Developer Tools

3,755

Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.

View details
83
Repo Health
75
Technical
66
Dependency
Built with
Python 94%
Updated yesterday
TypeScript
84%
Apache 2.0

ktx

AI Development · Analytics · Data Engineering

1,623

ktx builds a self-improving context layer over your data warehouse so AI agents like Claude Code and Codex query it with approved metric definitions instead of reinventing SQL logic from scratch.

View details
52
Repo Health
85
Technical
71
Dependency
Built with
TypeScript 84%
Updated 3 days ago
TypeScript
84%
Apache 2.0

nao

AI Development · Analytics

1,949

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
85
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 84%
Python 15%
Updated yesterday
TypeScript
92%
Other

OpenHands

AI Code Assistants · AI Development

91,695

The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.

View details
91
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 92%
Updated 2 days ago
TypeScript
58%
MIT

pad.ws

Collaboration · Design Tools

4,206

A browser-based whiteboard that doubles as a full development environment, letting you draw and code in the same canvas.

View details
37
Repo Health
61
Technical
78
Dependency
Built with
TypeScript 58%
Python 31%
SCSS 10%
Updated 1 years ago
Python
62%
Apache 2.0

Polar

Developer Tools · Ecommerce · Invoicing Finance

10,410

Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.

View details
90
Repo Health
82
Technical
66
Dependency
Built with
Python 62%
TypeScript 31%
Updated 2 days ago
Python
55%
Other

PostHog

Ab Testing Experimentation · Analytics · Developer Tools

40,397

The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.

View details
92
Repo Health
80
Technical
65
Dependency
Built with
Python 55%
TypeScript 36%
Updated yesterday
Python
79%
AGPL 3.0

Skyvern

AI Agents · Automation

23,257

Skyvern (YC S2023) automates browser-based workflows by pairing LLMs with computer vision, letting agents click, fill, and extract data on sites they've never seen, without brittle XPath selectors that break on every layout change.

View details
89
Repo Health
82
Technical
70
Dependency
Built with
Python 79%
TypeScript 19%
Updated yesterday
TypeScript
47%
Other

Stirling PDF

Digital Signiture · Productivity

94,824

The open-source PDF platform you can run anywhere — edit, convert, sign, and automate PDFs without sending files to external servers.

View details
92
Repo Health
86
Technical
68
Dependency
Built with
TypeScript 47%
Java 44%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers