master
Hanzo Insights Python SDK
Integrate Hanzo Insights into any Python application.
Installation
pip install hanzo-insights
Quick Start
from hanzo_insights import Insights
client = Insights('<your_project_api_key>', host='https://insights.hanzo.ai')
# Capture an event
client.capture('user_123', 'purchase', properties={'product': 'widget'})
# Feature flags
if client.feature_enabled('new-checkout', 'user_123'):
show_new_checkout()
Module-level usage
import hanzo_insights
hanzo_insights.api_key = '<your_project_api_key>'
hanzo_insights.host = 'https://insights.hanzo.ai'
hanzo_insights.capture('movie_played', distinct_id='user_123', properties={'movie_id': '42'})
hanzo_insights.shutdown()
Python Version Support
| SDK Version | Python Versions Supported |
|---|---|
| 7.3.1+ | 3.10, 3.11, 3.12, 3.13, 3.14 |
| 7.0.0 - 7.0.1 | 3.10, 3.11, 3.12, 3.13 |
| 4.0.1 - 6.x | 3.9, 3.10, 3.11, 3.12, 3.13 |
Development
We use uv.
uv python install 3.12
uv python pin 3.12
uv venv
source env/bin/activate
uv sync --extra dev --extra test
pre-commit install
make test
Running Tests
make test
# or run a specific test:
pytest -k test_no_api_key
License
MIT
Languages
Python
99.6%
Makefile
0.2%
Shell
0.1%