1{
2 lib,
3 stdenv,
4 aiohttp,
5 blinker,
6 buildPythonPackage,
7 certifi,
8 ecs-logging,
9 fetchFromGitHub,
10 fetchpatch,
11 httpx,
12 jinja2,
13 jsonschema,
14 logbook,
15 mock,
16 pytest-asyncio,
17 pytest-bdd,
18 pytest-localserver,
19 pytest-mock,
20 pytest-random-order,
21 pytestCheckHook,
22 pythonOlder,
23 sanic,
24 sanic-testing,
25 setuptools,
26 starlette,
27 structlog,
28 tornado,
29 urllib3,
30 webob,
31 wrapt,
32}:
33
34buildPythonPackage rec {
35 pname = "elastic-apm";
36 version = "6.23.0";
37 pyproject = true;
38
39 disabled = pythonOlder "3.8";
40
41 src = fetchFromGitHub {
42 owner = "elastic";
43 repo = "apm-agent-python";
44 tag = "v${version}";
45 hash = "sha256-S1Ebo9AWN+Mf3OFwxNTiR/AZtje3gNiYkZnVqGb7D4c=";
46 };
47
48 patches = [
49 (fetchpatch {
50 name = "fix-tests-with-latest-starlette-and-sanic.patch";
51 url = "https://github.com/elastic/apm-agent-python/commit/80d167f54b6bf1db8b6e7ee52e2ac6803bc64f54.patch";
52 hash = "sha256-VtA7+SyEZiL3aqpikyYJQ4tmdmsUpIdkSx6RtC1AzqY=";
53 })
54 ];
55
56 pythonRelaxDeps = [ "wrapt" ];
57
58 build-system = [ setuptools ];
59
60 dependencies = [
61 aiohttp
62 blinker
63 certifi
64 sanic
65 starlette
66 tornado
67 urllib3
68 wrapt
69 ];
70
71 nativeCheckInputs = [
72 ecs-logging
73 httpx
74 jinja2
75 jsonschema
76 logbook
77 mock
78 pytest-asyncio
79 pytest-bdd
80 pytest-localserver
81 pytest-mock
82 pytest-random-order
83 pytestCheckHook
84 sanic-testing
85 structlog
86 webob
87 ];
88
89 disabledTests = [
90 "elasticapm_client"
91 "test_get_name_from_func_partialmethod_unbound"
92 ];
93
94 disabledTestPaths = [
95 # Exclude tornado tests
96 "tests/contrib/asyncio/tornado/tornado_tests.py"
97 ]
98 ++ lib.optionals stdenv.hostPlatform.isDarwin [
99 # Flaky tests on Darwin
100 "tests/utils/threading_tests.py"
101 ];
102
103 pythonImportsCheck = [ "elasticapm" ];
104
105 meta = with lib; {
106 description = "Python agent for the Elastic APM";
107 homepage = "https://github.com/elastic/apm-agent-python";
108 changelog = "https://github.com/elastic/apm-agent-python/releases/tag/v${version}";
109 license = with licenses; [ bsd3 ];
110 maintainers = with maintainers; [ fab ];
111 mainProgram = "elasticapm-run";
112 };
113}