1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 certifi,
11 urllib3,
12
13 # optional-dependencies
14 aiohttp,
15 anthropic,
16 asyncpg,
17 apache-beam,
18 bottle,
19 celery,
20 celery-redbeat,
21 chalice,
22 clickhouse-driver,
23 django,
24 falcon,
25 fastapi,
26 flask,
27 blinker,
28 markupsafe,
29 grpcio,
30 protobuf,
31 httpx,
32 huey,
33 huggingface-hub,
34 langchain,
35 loguru,
36 openai,
37 tiktoken,
38 pure-eval,
39 executing,
40 asttokens,
41 pymongo,
42 pyspark,
43 quart,
44 rq,
45 sanic,
46 sqlalchemy,
47 starlette,
48 tornado,
49
50 # checks
51 ipdb,
52 jsonschema,
53 pip,
54 pyrsistent,
55 pysocks,
56 pytest-asyncio,
57 pytestCheckHook,
58 pytest-forked,
59 pytest-localserver,
60 pytest-xdist,
61 pytest-watch,
62 responses,
63}:
64
65buildPythonPackage rec {
66 pname = "sentry-sdk";
67 version = "2.15.0";
68 pyproject = true;
69
70 src = fetchFromGitHub {
71 owner = "getsentry";
72 repo = "sentry-python";
73 rev = "refs/tags/${version}";
74 hash = "sha256-jrApaDZ+R/bMOqOuQZguP9ySt6nKJeJYNpJTNTxq3no=";
75 };
76
77 postPatch = ''
78 sed -i "/addopts =/d" pytest.ini
79 '';
80
81 build-system = [
82 setuptools
83 ];
84
85 dependencies = [
86 certifi
87 urllib3
88 ];
89
90 optional-dependencies = {
91 aiohttp = [ aiohttp ];
92 anthropic = [ anthropic ];
93 # TODO: arq
94 asyncpg = [ asyncpg ];
95 beam = [ apache-beam ];
96 bottle = [ bottle ];
97 celery = [ celery ];
98 celery-redbeat = [ celery-redbeat ];
99 chalice = [ chalice ];
100 clickhouse-driver = [ clickhouse-driver ];
101 django = [ django ];
102 falcon = [ falcon ];
103 fastapi = [ fastapi ];
104 flask = [
105 blinker
106 flask
107 markupsafe
108 ];
109 grpcio = [
110 grpcio
111 protobuf
112 ];
113 httpx = [ httpx ];
114 huey = [ huey ];
115 huggingface-hub = [ huggingface-hub ];
116 langchain = [ langchain ];
117 loguru = [ loguru ];
118 openai = [
119 openai
120 tiktoken
121 ];
122 # TODO: opentelemetry
123 # TODO: opentelemetry-experimental
124 pure_eval = [
125 asttokens
126 executing
127 pure-eval
128 ];
129 pymongo = [ pymongo ];
130 pyspark = [ pyspark ];
131 quart = [
132 blinker
133 quart
134 ];
135 rq = [ rq ];
136 sanic = [ sanic ];
137 sqlalchemy = [ sqlalchemy ];
138 starlette = [ starlette ];
139 # TODO: starlite
140 tornado = [ tornado ];
141 };
142
143 nativeCheckInputs = [
144 ipdb
145 pyrsistent
146 responses
147 pysocks
148 setuptools
149 executing
150 jsonschema
151 pip
152 pytest-asyncio
153 pytest-forked
154 pytest-localserver
155 pytest-xdist
156 pytest-watch
157 pytestCheckHook
158 ];
159
160 __darwinAllowLocalNetworking = true;
161
162 disabledTests = [
163 # depends on git revision
164 "test_default_release"
165 # tries to pip install old setuptools version
166 "test_error_has_existing_trace_context_performance_disabled"
167 "test_error_has_existing_trace_context_performance_enabled"
168 "test_error_has_new_trace_context_performance_disabled"
169 "test_error_has_new_trace_context_performance_enabled"
170 "test_traces_sampler_gets_correct_values_in_sampling_context"
171 "test_performance_error"
172 "test_performance_no_error"
173 "test_timeout_error"
174 "test_handled_exception"
175 "test_unhandled_exception"
176 # network access
177 "test_create_connection_trace"
178 "test_crumb_capture"
179 "test_getaddrinfo_trace"
180 "test_omit_url_data_if_parsing_fails"
181 "test_span_origin"
182 # AttributeError: type object 'ABCMeta' has no attribute 'setup_once'
183 "test_ensure_integration_enabled_async_no_original_function_enabled"
184 "test_ensure_integration_enabled_no_original_function_enabled"
185 # sess = envelopes[1]
186 # IndexError: list index out of range
187 "test_session_mode_defaults_to_request_mode_in_wsgi_handler"
188 # assert count_item_types["sessions"] == 1
189 # assert 0 == 1
190 "test_auto_session_tracking_with_aggregates"
191 # timing sensitive
192 "test_profile_captured"
193 "test_continuous_profiler_manual_start_and_stop"
194 ];
195
196 pythonImportsCheck = [ "sentry_sdk" ];
197
198 meta = with lib; {
199 description = "Official Python SDK for Sentry.io";
200 homepage = "https://github.com/getsentry/sentry-python";
201 changelog = "https://github.com/getsentry/sentry-python/blob/${src.rev}/CHANGELOG.md";
202 license = licenses.mit;
203 maintainers = with maintainers; [ hexa ];
204 };
205}