posthog


Nameposthog JSON
Version 6.3.1 PyPI version JSON
download
home_pagehttps://github.com/posthog/posthog-python
SummaryIntegrate PostHog into any python application.
upload_time2025-07-23 09:52:20
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/2e/76/0274a52d50f55169892fdf8ac9b89258eb240e583149cf26bb0c65b0438e/posthog-6.3.1.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.3.1",
    "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": "524b5a18df5a15103898485d500ceec2ac60e856b72e4fd558315e8e8bceea11",
                "md5": "0b6394c81919ecb2b2cb3114336fe281",
                "sha256": "97ca81ac370f2ec0ba2d7a6e9b599114b03fdb87a183225c59391aeb2d90f12c"
            },
            "downloads": -1,
            "filename": "posthog-6.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b6394c81919ecb2b2cb3114336fe281",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 115325,
            "upload_time": "2025-07-23T09:52:19",
            "upload_time_iso_8601": "2025-07-23T09:52:19.790544Z",
            "url": "https://files.pythonhosted.org/packages/52/4b/5a18df5a15103898485d500ceec2ac60e856b72e4fd558315e8e8bceea11/posthog-6.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "2e760274a52d50f55169892fdf8ac9b89258eb240e583149cf26bb0c65b0438e",
                "md5": "2bdd2a239b70d9290ca245638b490791",
                "sha256": "4257d2a77c9577258fb7e7aa810b9a24fb413c4dc0a480cb7cd66b88cf2305ab"
            },
            "downloads": -1,
            "filename": "posthog-6.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2bdd2a239b70d9290ca245638b490791",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 97889,
            "upload_time": "2025-07-23T09:52:20",
            "upload_time_iso_8601": "2025-07-23T09:52:20.984036Z",
            "url": "https://files.pythonhosted.org/packages/2e/76/0274a52d50f55169892fdf8ac9b89258eb240e583149cf26bb0c65b0438e/posthog-6.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-23 09:52:20",
    "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: 0.95656s