Please see the Python integration docs for details.
- Run
python3 -m venv env
(creates virtual environment called "env") - Run
source env/bin/activate
(activates the virtual environment) - Run
python3 -m pip install -e ".[test]"
(installs the package in develop mode, along with test dependencies) - Run
make test
- To run a specific test do
pytest -k test_no_api_key
Assuming you have a local version of PostHog running, you can run python3 example.py
to see the library in action.
There's a sample Django project included, called sentry_django_example
, which explains how to use PostHog with Sentry.
There's 2 places of importance (Changes required are all marked with TODO in the sample project directory)
-
Settings.py
- Input your Sentry DSN
- Input your Sentry Org and ProjectID details into
PosthogIntegration()
- Add
POSTHOG_DJANGO
to settings.py. This allows thePosthogDistinctIdMiddleware
to get the distinct_ids
-
urls.py
- This includes the
sentry-debug/
endpoint, which generates an exception
- This includes the
To run things: make django_example
. This installs the posthog-python library with the sentry-sdk add-on, and then runs the django app.
Also start the PostHog app locally.
Then navigate to http://127.0.0.1:8080/sentry-debug/
and you should get an event in both Sentry and PostHog, with links to each other.
Updated are released using GitHub Actions: after bumping version.py
in master
, go to our release workflow's page and dispatch it manually, using workflow from master
.