chore: 添加虚拟环境到仓库

- 添加 backend_service/venv 虚拟环境
- 包含所有Python依赖包
- 注意:虚拟环境约393MB,包含12655个文件
This commit is contained in:
2025-12-03 10:19:25 +08:00
parent a6c2027caa
commit c4f851d387
12655 changed files with 3009376 additions and 0 deletions

View File

@@ -0,0 +1,138 @@
Metadata-Version: 2.4
Name: posthog
Version: 5.4.0
Summary: Integrate PostHog into any python application.
Home-page: https://github.com/posthog/posthog-python
Author: Posthog
Author-email: PostHog <hey@posthog.com>
Maintainer: PostHog
Maintainer-email: PostHog <hey@posthog.com>
License: MIT
Project-URL: Homepage, https://github.com/posthog/posthog-python
Project-URL: Repository, https://github.com/posthog/posthog-python
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests<3.0,>=2.7
Requires-Dist: six>=1.5
Requires-Dist: python-dateutil>=2.2
Requires-Dist: backoff>=1.10.0
Requires-Dist: distro>=1.5.0
Provides-Extra: langchain
Requires-Dist: langchain>=0.2.0; extra == "langchain"
Provides-Extra: dev
Requires-Dist: django-stubs; extra == "dev"
Requires-Dist: lxml; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: mypy-baseline; extra == "dev"
Requires-Dist: types-mock; extra == "dev"
Requires-Dist: types-python-dateutil; extra == "dev"
Requires-Dist: types-requests; extra == "dev"
Requires-Dist: types-setuptools; extra == "dev"
Requires-Dist: types-six; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pydantic; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: setuptools; extra == "dev"
Requires-Dist: packaging; extra == "dev"
Requires-Dist: wheel; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: tomli; extra == "dev"
Requires-Dist: tomli_w; extra == "dev"
Provides-Extra: test
Requires-Dist: mock>=2.0.0; extra == "test"
Requires-Dist: freezegun==1.5.1; extra == "test"
Requires-Dist: coverage; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-timeout; extra == "test"
Requires-Dist: pytest-asyncio; extra == "test"
Requires-Dist: django; extra == "test"
Requires-Dist: openai; extra == "test"
Requires-Dist: anthropic; extra == "test"
Requires-Dist: langgraph>=0.4.8; extra == "test"
Requires-Dist: langchain-core>=0.3.65; extra == "test"
Requires-Dist: langchain-community>=0.3.25; extra == "test"
Requires-Dist: langchain-openai>=0.3.22; extra == "test"
Requires-Dist: langchain-anthropic>=0.3.15; extra == "test"
Requires-Dist: google-genai; extra == "test"
Requires-Dist: pydantic; extra == "test"
Requires-Dist: parameterized>=0.8.1; extra == "test"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: maintainer
# 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 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](https://posthog.com/docs/developing-locally) 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](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.

View File

@@ -0,0 +1,95 @@
posthog-5.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
posthog-5.4.0.dist-info/METADATA,sha256=BwsAzTLCkehjM23sYs6Bxymeudqh8Qcg84sy0phw-nE,5683
posthog-5.4.0.dist-info/RECORD,,
posthog-5.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
posthog-5.4.0.dist-info/licenses/LICENSE,sha256=wGf9JBotDkSygFj43m49oiKlFnpMnn97keiZKF-40vE,2450
posthog-5.4.0.dist-info/top_level.txt,sha256=7FBLsRjIUHVKQsXIhozuI3k-mun1tapp8iZO9EmUPEw,8
posthog/__init__.py,sha256=94pebpP5CLR85mSi1SBuKuffrJl_6fF2k01Q54_dBUA,19635
posthog/__pycache__/__init__.cpython-313.pyc,,
posthog/__pycache__/client.cpython-313.pyc,,
posthog/__pycache__/consumer.cpython-313.pyc,,
posthog/__pycache__/exception_capture.cpython-313.pyc,,
posthog/__pycache__/exception_utils.cpython-313.pyc,,
posthog/__pycache__/feature_flags.cpython-313.pyc,,
posthog/__pycache__/poller.cpython-313.pyc,,
posthog/__pycache__/request.cpython-313.pyc,,
posthog/__pycache__/scopes.cpython-313.pyc,,
posthog/__pycache__/types.cpython-313.pyc,,
posthog/__pycache__/utils.cpython-313.pyc,,
posthog/__pycache__/version.cpython-313.pyc,,
posthog/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
posthog/ai/__pycache__/__init__.cpython-313.pyc,,
posthog/ai/__pycache__/utils.cpython-313.pyc,,
posthog/ai/anthropic/__init__.py,sha256=fFhDOiRzTXzGQlgnrRDL-4yKC8EYIl8NW4a2QNR6xRU,368
posthog/ai/anthropic/__pycache__/__init__.cpython-313.pyc,,
posthog/ai/anthropic/__pycache__/anthropic.cpython-313.pyc,,
posthog/ai/anthropic/__pycache__/anthropic_async.cpython-313.pyc,,
posthog/ai/anthropic/__pycache__/anthropic_providers.cpython-313.pyc,,
posthog/ai/anthropic/anthropic.py,sha256=KkDNK1qfRlGpdtKeuw2j6VDa83uMT8QQvaTH4ItItCc,7310
posthog/ai/anthropic/anthropic_async.py,sha256=iZ14TMBecAD4kuwIA9HSHw9bz5uStKvZAtcFeyUnB3s,7430
posthog/ai/anthropic/anthropic_providers.py,sha256=s4v7nSOcGV0YKX_Wk7q602mQrj1s76gH1UVq1WcJW54,1936
posthog/ai/gemini/__init__.py,sha256=bMNBnJ6NO_PCQCwmxKIiw4adFuEQ06hFFBALt-aDW-0,174
posthog/ai/gemini/__pycache__/__init__.cpython-313.pyc,,
posthog/ai/gemini/__pycache__/gemini.cpython-313.pyc,,
posthog/ai/gemini/gemini.py,sha256=KJ9rg5mfTDRgvmGw2bNompTwjLZGPL_i8OaFNhNV7oM,13134
posthog/ai/langchain/__init__.py,sha256=9CqAwLynTGj3ASAR80C3PmdTdrYGmu99tz0JL-HPFgI,70
posthog/ai/langchain/__pycache__/__init__.cpython-313.pyc,,
posthog/ai/langchain/__pycache__/callbacks.cpython-313.pyc,,
posthog/ai/langchain/callbacks.py,sha256=JvTjGKXkm4suRvYHTF1oq42I63EPE5OWguGfgrgCZMM,28835
posthog/ai/openai/__init__.py,sha256=_flZxkyaDZme9hxJsY31sMlq4nP1dtc75HmNgj-21Kg,197
posthog/ai/openai/__pycache__/__init__.cpython-313.pyc,,
posthog/ai/openai/__pycache__/openai.cpython-313.pyc,,
posthog/ai/openai/__pycache__/openai_async.cpython-313.pyc,,
posthog/ai/openai/__pycache__/openai_providers.cpython-313.pyc,,
posthog/ai/openai/openai.py,sha256=WlGh4x0spmf-cZ81R-6lxICWbq-ulW86IeeVEU1q29k,23376
posthog/ai/openai/openai_async.py,sha256=IfWJri91njD63Wh26DEwDeG84D9GJj8jekSWkck66lE,23751
posthog/ai/openai/openai_providers.py,sha256=-9Hcu79sLm9CbA_fpmRdD3BB0cFMcto5MzuHSvt6qgQ,3830
posthog/ai/utils.py,sha256=R6gM6cEOtElqqdi2anwSaoz4DyWT54DBlV0Dapw9GuY,19520
posthog/client.py,sha256=FRvmo8lTLEhY8XKN2tiL_2bMbLDsOgbjaYNRMMCKqZI,48957
posthog/consumer.py,sha256=fdteMZ-deJGMpaQmHyznw_cwQG2Vvld1tmN9LUkZPrY,4608
posthog/exception_capture.py,sha256=azngdtkvWMkVW-UY3KpZf1WmkRrCaxcXMExyi9czUIs,2706
posthog/exception_integrations/__init__.py,sha256=Xcrhc37EXc0mSfkUhFzglx0nCvGivZtohBqBZ2VdIsU,187
posthog/exception_integrations/__pycache__/__init__.cpython-313.pyc,,
posthog/exception_integrations/__pycache__/django.cpython-313.pyc,,
posthog/exception_integrations/django.py,sha256=xy1mTu8TK6lyltep-Hhbh23YRGBwZ1OqElXcyyvnmMY,3699
posthog/exception_utils.py,sha256=T7vh88VWO1gWES5VkE8uR7zKOez6KBC-kRDnSPQKA0A,29680
posthog/feature_flags.py,sha256=rycEVaPfaNqAz9CMOqfMDHDScdamRE4qdCogvUJTTqU,13625
posthog/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
posthog/integrations/__pycache__/__init__.cpython-313.pyc,,
posthog/integrations/__pycache__/django.cpython-313.pyc,,
posthog/integrations/django.py,sha256=xbQfIDptDVUSy8EEpUyk5xXb7hl3-tDPjhNvJpHbpz0,4925
posthog/poller.py,sha256=jBz5rfH_kn_bBz7wCB46Fpvso4ttx4uzqIZWvXBCFmQ,595
posthog/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
posthog/request.py,sha256=ZsqazO__xPp2F6zT1FavwqCHP0Dyi_LlwfQSHkonmhg,6106
posthog/scopes.py,sha256=jo4XJJWVZ9AKyX0FDwSrbhy5OrTXErBe7Q1YpiIR79E,8185
posthog/test/__init__.py,sha256=VYgM6xPbJbvS-xhIcDiBRs0MFC9V_jT65uNeerCz_rM,299
posthog/test/__pycache__/__init__.cpython-313.pyc,,
posthog/test/__pycache__/test_before_send.cpython-313.pyc,,
posthog/test/__pycache__/test_client.cpython-313.pyc,,
posthog/test/__pycache__/test_consumer.cpython-313.pyc,,
posthog/test/__pycache__/test_exception_capture.cpython-313.pyc,,
posthog/test/__pycache__/test_feature_flag.cpython-313.pyc,,
posthog/test/__pycache__/test_feature_flag_result.cpython-313.pyc,,
posthog/test/__pycache__/test_feature_flags.cpython-313.pyc,,
posthog/test/__pycache__/test_module.cpython-313.pyc,,
posthog/test/__pycache__/test_request.cpython-313.pyc,,
posthog/test/__pycache__/test_scopes.cpython-313.pyc,,
posthog/test/__pycache__/test_size_limited_dict.cpython-313.pyc,,
posthog/test/__pycache__/test_types.cpython-313.pyc,,
posthog/test/__pycache__/test_utils.cpython-313.pyc,,
posthog/test/test_before_send.py,sha256=GVSxZ7mne_nEeIgtUCmmxrZ-TYoFwYyjAP_k195bm7E,5941
posthog/test/test_client.py,sha256=pJ_IJLd9dSc73MY_RYg7IoqCougggatDCv0uTqz90Wk,64635
posthog/test/test_consumer.py,sha256=HRDXSH0IPpCfo5yHs23n-0VzFyGSjWBKLEa8XNtU3_Y,7080
posthog/test/test_exception_capture.py,sha256=6JPzO6_rv5JIpqDVEX9cnWn986ajbcKvFzKNTWvHUZY,2130
posthog/test/test_feature_flag.py,sha256=yIMJkoRtdJr91Y6Rb0PPlpZWBIR394TgWhccnlf-vYE,6815
posthog/test/test_feature_flag_result.py,sha256=-1Mf4kOQ8V5PrkdYSj_a2UVLwjv_9BoZrQUuz_TpspE,15733
posthog/test/test_feature_flags.py,sha256=CbmH7wgCsml1loN8b1qHxMDDU1bshtRJpTWIiYv7qB4,168693
posthog/test/test_module.py,sha256=UXgXa9Sfsc9oFz4bY_tOdVNo-LmNLwfe05AVcbABDX8,1405
posthog/test/test_request.py,sha256=l19WVyZQc4Iqmh_bpnAFOj4nGRpDK1iO-o5aJDQfFdo,4449
posthog/test/test_scopes.py,sha256=nStHAaIg_RRAzb-4AbPsBrzJV8UTSBX0zcDk_6y4YtU,7317
posthog/test/test_size_limited_dict.py,sha256=Wom7BkzpHmusHilZy0SV3PNzhw7ucuQgqrx86jf8euo,765
posthog/test/test_types.py,sha256=csLuBiz6RMV36cpg9LVIor4Khq6MfjjGxYXodx5VttY,7586
posthog/test/test_utils.py,sha256=buG9-YNsc4Fo_o7Pfn4P85JtHlrXn3H9c-Fg2RkcZXg,5419
posthog/types.py,sha256=INxWBOEQc0xgPcap6FdQNSU7zuQBmKShYaGzyuHKql8,9128
posthog/utils.py,sha256=4qw-5PMYVXS66367olLYn8IqGNKcwfevv5n7w1Mjh2Q,5587
posthog/version.py,sha256=I85JOowUqLrC4sAZT80knLum_fFLg-MOlCH3fUL7AoE,87

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: setuptools (80.9.0)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1,48 @@
Copyright (c) 2023 PostHog (part of Hiberly Inc)
Copyright (c) 2013 Segment Inc. friends@segment.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
---
Some files in this codebase contain code from getsentry/sentry-javascript by Software, Inc. dba Sentry.
In such cases it is explicitly stated in the file header. This license only applies to the relevant code in such cases.
MIT License
Copyright (c) 2012 Functional Software, Inc. dba Sentry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.