Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Send usage data from your Python code to PostHog.

License

NotificationsYou must be signed in to change notification settings

PostHog/posthog-python

Repository files navigation

posthoglogo

pypi installsGitHub contributorsGitHub commit activityGitHub closed issues

Please see thePython integration docs for details.

Development

Testing Locally

We recommend usinguv. It's super fast.

  1. Runuv venv env (creates virtual environment called "env")
    • orpython3 -m venv env
  2. Runsource env/bin/activate (activates the virtual environment)
  3. Runuv sync --extra dev --extra test (installs the package in develop mode, along with test dependencies)
    • orpip install -e ".[dev,test]"
  4. you have to runpre-commit install to have auto linting pre commit
  5. Runmake test
  6. To run a specific test dopytest -k test_no_api_key

PostHog recommendsuv so...

uv python install 3.9.19uv python pin 3.9.19uv venvsource env/bin/activateuv sync --extra dev --extratestpre-commit installmaketest

Running Locally

Assuming you have alocal version of PostHog running, you can runpython3 example.py to see the library in action.

Releasing Versions

Updates are released automatically using GitHub Actions whenversion.py is updated onmaster. After bumpingversion.py inmaster and adding toCHANGELOG.md, therelease workflow will automatically trigger and deploy the new version.

If you need to check the latest runs or manually trigger a release, you can go toour release workflow's page and dispatch it manually, using workflow frommaster.

Testing changes locally with the PostHog app

You can runmake prep_local, and it'll create a new folder alongside the SDK repo one calledposthog-python-local, which you can then import into the posthog project by changing pyproject.toml to look like this:

dependencies = [..."posthoganalytics"#NOTE: no version number...]...[tools.uv.sources]posthoganalytics = {path ="../posthog-python-local" }

This'll let you build and test SDK changes fully locally, incorporating them into your local posthog app stack. It mainly takes care of theposthog -> posthoganalytics module renaming. You'll need to re-runmake prep_local each time you make a change, and re-runuv sync --active in the posthog app project.

About

Send usage data from your Python code to PostHog.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp