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 apache-beam,
17 asttokens,
18 asyncpg,
19 blinker,
20 bottle,
21 celery,
22 celery-redbeat,
23 chalice,
24 clickhouse-driver,
25 django,
26 executing,
27 falcon,
28 fastapi,
29 flask,
30 grpcio,
31 httpcore,
32 httpx,
33 huey,
34 huggingface-hub,
35 langchain,
36 litestar,
37 loguru,
38 markupsafe,
39 openai,
40 protobuf,
41 pure-eval,
42 pymongo,
43 pyspark,
44 quart,
45 rq,
46 sanic,
47 sqlalchemy,
48 starlette,
49 tiktoken,
50 tornado,
51
52 # checks
53 brotli,
54 jsonschema,
55 pip,
56 pyrsistent,
57 pysocks,
58 pytest-asyncio,
59 pytestCheckHook,
60 pytest-forked,
61 pytest-localserver,
62 pytest-xdist,
63 pytest-watch,
64 responses,
65 stdenv,
66}:
67
68buildPythonPackage rec {
69 pname = "sentry-sdk";
70 version = "2.34.1";
71 pyproject = true;
72
73 src = fetchFromGitHub {
74 owner = "getsentry";
75 repo = "sentry-python";
76 tag = version;
77 hash = "sha256-RQnjvX3bDiB9csn/DsQ769EiVm7HY+B7x9V5jpvsOOA=";
78 };
79
80 postPatch = ''
81 sed -i "/addopts =/d" pyproject.toml
82 '';
83
84 build-system = [
85 setuptools
86 ];
87
88 dependencies = [
89 certifi
90 urllib3
91 ];
92
93 optional-dependencies = {
94 aiohttp = [ aiohttp ];
95 anthropic = [ anthropic ];
96 # TODO: arq
97 asyncpg = [ asyncpg ];
98 beam = [ apache-beam ];
99 bottle = [ bottle ];
100 celery = [ celery ];
101 celery-redbeat = [ celery-redbeat ];
102 chalice = [ chalice ];
103 clickhouse-driver = [ clickhouse-driver ];
104 django = [ django ];
105 falcon = [ falcon ];
106 fastapi = [ fastapi ];
107 flask = [
108 blinker
109 flask
110 markupsafe
111 ];
112 grpcio = [
113 grpcio
114 protobuf
115 ];
116 http2 = [ httpcore ] ++ httpcore.optional-dependencies.http2;
117 httpx = [ httpx ];
118 huey = [ huey ];
119 huggingface-hub = [ huggingface-hub ];
120 langchain = [ langchain ];
121 # TODO: launchdarkly
122 litestar = [ litestar ];
123 loguru = [ loguru ];
124 openai = [
125 openai
126 tiktoken
127 ];
128 # TODO: openfeature
129 # TODO: opentelemetry
130 # TODO: opentelemetry-experimental
131 pure_eval = [
132 asttokens
133 executing
134 pure-eval
135 ];
136 pymongo = [ pymongo ];
137 pyspark = [ pyspark ];
138 quart = [
139 blinker
140 quart
141 ];
142 rq = [ rq ];
143 sanic = [ sanic ];
144 sqlalchemy = [ sqlalchemy ];
145 starlette = [ starlette ];
146 # TODO: starlite
147 # TODO: statsig
148 tornado = [ tornado ];
149 # TODO: unleash
150 };
151
152 nativeCheckInputs = [
153 brotli
154 pyrsistent
155 responses
156 pysocks
157 setuptools
158 executing
159 jsonschema
160 pip
161 pytest-asyncio
162 pytest-forked
163 pytest-localserver
164 pytest-xdist
165 pytest-watch
166 pytestCheckHook
167 ]
168 ++ optional-dependencies.http2;
169
170 __darwinAllowLocalNetworking = true;
171
172 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
173 # darwin: 'profiler should not be running'
174 "tests/profiler/test_continuous_profiler.py"
175 ];
176
177 disabledTests = [
178 # depends on git revision
179 "test_default_release"
180 # tries to pip install old setuptools version
181 "test_error_has_existing_trace_context_performance_disabled"
182 "test_error_has_existing_trace_context_performance_enabled"
183 "test_error_has_new_trace_context_performance_disabled"
184 "test_error_has_new_trace_context_performance_enabled"
185 "test_traces_sampler_gets_correct_values_in_sampling_context"
186 "test_performance_error"
187 "test_performance_no_error"
188 "test_timeout_error"
189 "test_handled_exception"
190 "test_unhandled_exception"
191 # network access
192 "test_create_connection_trace"
193 "test_crumb_capture"
194 "test_getaddrinfo_trace"
195 "test_omit_url_data_if_parsing_fails"
196 "test_span_origin"
197 # AttributeError: type object 'ABCMeta' has no attribute 'setup_once'
198 "test_ensure_integration_enabled_async_no_original_function_enabled"
199 "test_ensure_integration_enabled_no_original_function_enabled"
200 # sess = envelopes[1]
201 # IndexError: list index out of range
202 "test_session_mode_defaults_to_request_mode_in_wsgi_handler"
203 # assert count_item_types["sessions"] == 1
204 # assert 0 == 1
205 "test_auto_session_tracking_with_aggregates"
206 # timing sensitive
207 "test_profile_captured"
208 "test_continuous_profiler_auto"
209 "test_continuous_profiler_manual"
210 "test_stacktrace_big_recursion"
211 # assert ('socks' in "<class 'httpcore.connectionpool'>") == True
212 "test_socks_proxy"
213 # requires socksio to mock, but that crashes pytest-forked
214 "test_http_timeout"
215 # KeyError: 'sentry.release'
216 "test_logs_attributes"
217 "test_logger_with_all_attributes"
218 ];
219
220 pythonImportsCheck = [ "sentry_sdk" ];
221
222 meta = with lib; {
223 description = "Official Python SDK for Sentry.io";
224 homepage = "https://github.com/getsentry/sentry-python";
225 changelog = "https://github.com/getsentry/sentry-python/blob/${src.tag}/CHANGELOG.md";
226 license = licenses.mit;
227 maintainers = with maintainers; [ hexa ];
228 };
229}