1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 # build inputs
6 requests,
7 six,
8 monotonic,
9 backoff,
10 python-dateutil,
11 # check inputs
12 pytestCheckHook,
13 mock,
14 freezegun,
15}:
16let
17 pname = "posthog";
18 version = "3.5.0";
19in
20buildPythonPackage {
21 inherit pname version;
22 format = "setuptools";
23
24 src = fetchFromGitHub {
25 owner = "PostHog";
26 repo = "posthog-python";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-+nYMQxqI9RZ5vVL6KgiRLcx0JHWJTs/rZ6U6jIuaz+w=";
29 };
30
31 propagatedBuildInputs = [
32 requests
33 six
34 monotonic
35 backoff
36 python-dateutil
37 ];
38
39 nativeCheckInputs = [
40 pytestCheckHook
41 mock
42 freezegun
43 ];
44
45 pythonImportsCheck = [ "posthog" ];
46
47 disabledTests = [
48 "test_load_feature_flags_wrong_key"
49 # Tests require network access
50 "test_request"
51 "test_upload"
52 ];
53
54 meta = with lib; {
55 description = "Official PostHog python library";
56 homepage = "https://github.com/PostHog/posthog-python";
57 changelog = "https://github.com/PostHog/posthog-python/releases/tag/v${version}";
58 license = licenses.mit;
59 maintainers = with maintainers; [ happysalada ];
60 };
61}