posthog


Nameposthog JSON
Version 6.7.4 PyPI version JSON
download
home_pagehttps://github.com/posthog/posthog-python
SummaryIntegrate PostHog into any python application.
upload_time2025-09-05 15:29:21
maintainerPostHog
docs_urlNone
authorPosthog
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PostHog Python

<p align="center">
  <img alt="posthoglogo" src="https://user-images.githubusercontent.com/65415371/205059737-c8a4f836-4889-4654-902e-f302b187b6a0.png">
</p>
<p align="center">
   <a href="https://pypi.org/project/posthog/"><img alt="pypi installs" src="https://img.shields.io/pypi/v/posthog"/></a>
   <img alt="GitHub contributors" src="https://img.shields.io/github/contributors/posthog/posthog-python">
  <img alt="GitHub commit activity" src="https://img.shields.io/github/commit-activity/m/posthog/posthog-python"/>
  <img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/posthog/posthog-python"/>
</p>

Please see the [Python integration docs](https://posthog.com/docs/integrations/python-integration) for details.

## Development

### Testing Locally

We recommend using [uv](https://docs.astral.sh/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`
  1. To run a specific test do `pytest -k test_no_api_key`

## PostHog recommends `uv` so...

```bash
uv python install 3.9.19
uv python pin 3.9.19
uv venv
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](https://posthog.com/docs/developing-locally) running, you can run `python3 example.py` to see the library in action.

### Releasing Versions

Updates are released automatically using GitHub Actions when `version.py` is updated on `master`. After bumping `version.py` in `master` and adding to `CHANGELOG.md`, the [release workflow](https://github.com/PostHog/posthog-python/blob/master/.github/workflows/release.yaml) will automatically trigger and deploy the new version.

If you need to check the latest runs or manually trigger a release, you can go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.


### Testing changes locally with the PostHog app

You can run `make prep_local`, and it'll create a new folder alongside the SDK repo one called `posthog-python-local`, which you can then import into the posthog project by changing pyproject.toml to look like this:
```toml
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 the `posthog -> posthoganalytics` module renaming. You'll need to re-run `make prep_local` each time you make a change, and re-run `uv sync --active` in the posthog app project.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/posthog/posthog-python",
    "name": "posthog",
    "maintainer": "PostHog",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "PostHog <hey@posthog.com>",
    "keywords": null,
    "author": "Posthog",
    "author_email": "PostHog <hey@posthog.com>",
    "download_url": "https://files.pythonhosted.org/packages/0f/40/d7f585e09e47f492ebaeb8048a8e2ce5d9f49a3896856a7a975cbc1484fa/posthog-6.7.4.tar.gz",
    "platform": null,
    "description": "# PostHog Python\n\n<p align=\"center\">\n  <img alt=\"posthoglogo\" src=\"https://user-images.githubusercontent.com/65415371/205059737-c8a4f836-4889-4654-902e-f302b187b6a0.png\">\n</p>\n<p align=\"center\">\n   <a href=\"https://pypi.org/project/posthog/\"><img alt=\"pypi installs\" src=\"https://img.shields.io/pypi/v/posthog\"/></a>\n   <img alt=\"GitHub contributors\" src=\"https://img.shields.io/github/contributors/posthog/posthog-python\">\n  <img alt=\"GitHub commit activity\" src=\"https://img.shields.io/github/commit-activity/m/posthog/posthog-python\"/>\n  <img alt=\"GitHub closed issues\" src=\"https://img.shields.io/github/issues-closed/posthog/posthog-python\"/>\n</p>\n\nPlease see the [Python integration docs](https://posthog.com/docs/integrations/python-integration) for details.\n\n## Development\n\n### Testing Locally\n\nWe recommend using [uv](https://docs.astral.sh/uv/). It's super fast.\n\n1. Run `uv venv env` (creates virtual environment called \"env\")\n    * or `python3 -m venv env`\n2. Run `source env/bin/activate` (activates the virtual environment)\n3. Run `uv sync --extra dev --extra test` (installs the package in develop mode, along with test dependencies)\n    * or `pip install -e \".[dev,test]\"`\n4. you have to run `pre-commit install` to have auto linting pre commit\n5. Run `make test`\n  1. To run a specific test do `pytest -k test_no_api_key`\n\n## PostHog recommends `uv` so...\n\n```bash\nuv python install 3.9.19\nuv python pin 3.9.19\nuv venv\nsource env/bin/activate\nuv sync --extra dev --extra test\npre-commit install\nmake test\n```\n\n### Running Locally\n\nAssuming you have a [local version of PostHog](https://posthog.com/docs/developing-locally) running, you can run `python3 example.py` to see the library in action.\n\n### Releasing Versions\n\nUpdates are released automatically using GitHub Actions when `version.py` is updated on `master`. After bumping `version.py` in `master` and adding to `CHANGELOG.md`, the [release workflow](https://github.com/PostHog/posthog-python/blob/master/.github/workflows/release.yaml) will automatically trigger and deploy the new version.\n\nIf you need to check the latest runs or manually trigger a release, you can go to [our release workflow's page](https://github.com/PostHog/posthog-python/actions/workflows/release.yaml) and dispatch it manually, using workflow from `master`.\n\n\n### Testing changes locally with the PostHog app\n\nYou can run `make prep_local`, and it'll create a new folder alongside the SDK repo one called `posthog-python-local`, which you can then import into the posthog project by changing pyproject.toml to look like this:\n```toml\ndependencies = [\n    ...\n    \"posthoganalytics\" #NOTE: no version number\n    ...\n]\n...\n[tools.uv.sources]\nposthoganalytics = { path = \"../posthog-python-local\" }\n```\nThis'll let you build and test SDK changes fully locally, incorporating them into your local posthog app stack. It mainly takes care of the `posthog -> posthoganalytics` module renaming. You'll need to re-run `make prep_local` each time you make a change, and re-run `uv sync --active` in the posthog app project.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Integrate PostHog into any python application.",
    "version": "6.7.4",
    "project_urls": {
        "Homepage": "https://github.com/posthog/posthog-python",
        "Repository": "https://github.com/posthog/posthog-python"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bb95e795059ef73d480a7f11f1be201087f65207509525920897fb514a04914c",
                "md5": "a29ddb7ab01e0012f68326d08cb144a6",
                "sha256": "7f1872c53ec7e9a29b088a5a1ad03fa1be3b871d10d70c8bf6c2dafb91beaac5"
            },
            "downloads": -1,
            "filename": "posthog-6.7.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a29ddb7ab01e0012f68326d08cb144a6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 136409,
            "upload_time": "2025-09-05T15:29:19",
            "upload_time_iso_8601": "2025-09-05T15:29:19.995096Z",
            "url": "https://files.pythonhosted.org/packages/bb/95/e795059ef73d480a7f11f1be201087f65207509525920897fb514a04914c/posthog-6.7.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0f40d7f585e09e47f492ebaeb8048a8e2ce5d9f49a3896856a7a975cbc1484fa",
                "md5": "ed805d75e480e921bea891805d5aeec7",
                "sha256": "2bfa74f321ac18efe4a48a256d62034a506ca95477af7efa32292ed488a742c5"
            },
            "downloads": -1,
            "filename": "posthog-6.7.4.tar.gz",
            "has_sig": false,
            "md5_digest": "ed805d75e480e921bea891805d5aeec7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 118209,
            "upload_time": "2025-09-05T15:29:21",
            "upload_time_iso_8601": "2025-09-05T15:29:21.517198Z",
            "url": "https://files.pythonhosted.org/packages/0f/40/d7f585e09e47f492ebaeb8048a8e2ce5d9f49a3896856a7a975cbc1484fa/posthog-6.7.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-05 15:29:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "posthog",
    "github_project": "posthog-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "posthog"
}
        
Elapsed time: 1.66071s