about summary refs log tree commit diff
path: root/pkgs/development/python-modules/sentry-sdk/default.nix
blob: d29532748da4b209ee45c6feb25c29ea2383ae21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
{ lib
, buildPythonPackage
, fetchFromGitHub

# build-system
, setuptools

# dependencies
, certifi
, urllib3

# optional-dependencies
, aiohttp
, anthropic
, asyncpg
, apache-beam
, bottle
, celery
, celery-redbeat
, chalice
, clickhouse-driver
, django
, falcon
, fastapi
, flask
, blinker
, markupsafe
, grpcio
, protobuf
, httpx
, huey
, huggingface-hub
, langchain
, loguru
, openai
, tiktoken
, pure-eval
, executing
, asttokens
, pymongo
, pyspark
, quart
, rq
, sanic
, sqlalchemy
, starlette
, tornado

# checks
, ipdb
, jsonschema
, pip
, pyrsistent
, pysocks
, pytest-asyncio
, pytestCheckHook
, pytest-forked
, pytest-localserver
, pytest-xdist
, pytest-watch
, responses
}:

buildPythonPackage rec {
  pname = "sentry-sdk";
  version = "2.9.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "getsentry";
    repo = "sentry-python";
    rev = version;
    hash = "sha256-0nk5ljHm1bv/Ay0tqR3zrAfw4RKgOVq8a4hJ82w73xo=";
  };

  postPatch = ''
    sed -i "/addopts =/d" pytest.ini
  '';

  build-system = [
    setuptools
  ];

  dependencies = [
    certifi
    urllib3
  ];

  optional-dependencies = {
    aiohttp = [ aiohttp ];
    anthropic = [ anthropic ];
    # TODO: arq
    asyncpg = [ asyncpg ];
    beam = [ apache-beam ];
    bottle = [ bottle ];
    celery = [ celery ];
    celery-redbeat = [ celery-redbeat ];
    chalice = [ chalice ];
    clickhouse-driver = [ clickhouse-driver ];
    django = [ django ];
    falcon = [ falcon ];
    fastapi = [ fastapi ];
    flask = [
      blinker
      flask
      markupsafe
    ];
    grpcio = [
      grpcio
      protobuf
    ];
    httpx = [ httpx ];
    huey = [ huey ];
    huggingface-hub = [ huggingface-hub ];
    langchain = [ langchain ];
    loguru = [ loguru ];
    openai = [
      openai
      tiktoken
    ];
    # TODO: opentelemetry
    # TODO: opentelemetry-experimental
    pure_eval = [
      asttokens
      executing
      pure-eval
    ];
    pymongo = [ pymongo ];
    pyspark = [ pyspark ];
    quart = [
      blinker
      quart
    ];
    rq = [ rq ];
    sanic = [ sanic ];
    sqlalchemy = [ sqlalchemy ];
    starlette = [ starlette ];
    # TODO: starlite
    tornado = [ tornado ];
  };

  nativeCheckInputs = [
    ipdb
    pyrsistent
    responses
    pysocks
    setuptools
    executing
    jsonschema
    pip
    pytest-asyncio
    pytest-forked
    pytest-localserver
    pytest-xdist
    pytest-watch
    pytestCheckHook
  ];

  __darwinAllowLocalNetworking = true;

  disabledTests = [
    # depends on git revision
    "test_default_release"
    # tries to pip install old setuptools version
    "test_error_has_existing_trace_context_performance_disabled"
    "test_error_has_existing_trace_context_performance_enabled"
    "test_error_has_new_trace_context_performance_disabled"
    "test_error_has_new_trace_context_performance_enabled"
    "test_traces_sampler_gets_correct_values_in_sampling_context"
    "test_performance_error"
    "test_performance_no_error"
    "test_timeout_error"
    "test_handled_exception"
    "test_unhandled_exception"
    # network access
    "test_create_connection_trace"
    "test_crumb_capture"
    "test_getaddrinfo_trace"
    "test_omit_url_data_if_parsing_fails"
    "test_span_origin"
    # AttributeError: type object 'ABCMeta' has no attribute 'setup_once'
    "test_ensure_integration_enabled_async_no_original_function_enabled"
    "test_ensure_integration_enabled_no_original_function_enabled"
    # sess = envelopes[1]
    # IndexError: list index out of range
    "test_session_mode_defaults_to_request_mode_in_wsgi_handler"
    # assert count_item_types["sessions"] == 1
    # assert 0 == 1
    "test_auto_session_tracking_with_aggregates"
  ];

  pythonImportsCheck = [ "sentry_sdk" ];

  meta = with lib; {
    description = "Official Python SDK for Sentry.io";
    homepage = "https://github.com/getsentry/sentry-python";
    changelog = "https://github.com/getsentry/sentry-python/blob/${src.rev}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ hexa ];
  };
}