Skip to content

PostHog/posthog-python

Repository files navigation

PostHog Python

posthoglogo

pypi installs GitHub contributors GitHub commit activity GitHub closed issues

Please see the Python integration docs for details.

Development

Testing Locally

We recommend using uv. It's super fast.

  1. Run uv venv env (creates virtual environment called "env")
    • or python3 -m venv env
  2. Run source env/bin/activate (activates the virtual environment)
  3. Run uv sync --extra dev --extra test (installs the package in develop mode, along with test dependencies)
    • or pip install -e ".[dev,test]"
  4. you have to run pre-commit install to have auto linting pre commit
  5. Run make test
  6. To run a specific test do pytest -k test_no_api_key

PostHog recommends uv so...

uv python install 3.9.19
uv python pin 3.9.19
uv venv env
source env/bin/activate
uv sync --extra dev --extra test
pre-commit install
make test

Running Locally

Assuming you have a local version of PostHog running, you can run python3 example.py to see the library in action.

Releasing Versions

Updates are released using GitHub Actions: after bumping version.py in master and adding to CHANGELOG.md, go to our release workflow's page and dispatch it manually, using workflow from master.

About

Send usage data from your Python code to PostHog.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 38

Languages