1{
2 lib,
3 anthropic,
4 backoff,
5 buildPythonPackage,
6 distro,
7 fetchFromGitHub,
8 freezegun,
9 mock,
10 monotonic,
11 openai,
12 parameterized,
13 pytestCheckHook,
14 python-dateutil,
15 requests,
16 setuptools,
17 six,
18}:
19
20buildPythonPackage rec {
21 pname = "posthog";
22 version = "4.0.1";
23 pyproject = true;
24
25 src = fetchFromGitHub {
26 owner = "PostHog";
27 repo = "posthog-python";
28 tag = "v${version}";
29 hash = "sha256-JEoltzbpbHOehdqaKkGJbrcjaOXC7wDQh++S/klsW9o=";
30 };
31
32 build-system = [ setuptools ];
33
34 dependencies = [
35 backoff
36 distro
37 monotonic
38 python-dateutil
39 requests
40 six
41 ];
42
43 nativeCheckInputs = [
44 anthropic
45 freezegun
46 mock
47 openai
48 parameterized
49 pytestCheckHook
50 ];
51
52 pythonImportsCheck = [ "posthog" ];
53
54 disabledTests = [
55 "test_load_feature_flags_wrong_key"
56 # Tests require network access
57 "test_excepthook"
58 "test_request"
59 "test_trying_to_use_django_integration"
60 "test_upload"
61 # AssertionError: 2 != 3
62 "test_flush_interval"
63 ];
64
65 disabledTestPaths = [
66 # Revisit this at the next version bump, issue open upstream
67 # See https://github.com/PostHog/posthog-python/issues/234
68 "posthog/test/ai/openai/test_openai.py"
69 ];
70
71 meta = {
72 description = "Module for interacting with PostHog";
73 homepage = "https://github.com/PostHog/posthog-python";
74 changelog = "https://github.com/PostHog/posthog-python/blob/${src.tag}/CHANGELOG.md";
75 license = lib.licenses.mit;
76 maintainers = with lib.maintainers; [ happysalada ];
77 };
78}