From 7420d9dbb8fa97dfa81c49ec39c500479a52083a Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Mon, 1 Jul 2024 03:33:43 +0200 Subject: [PATCH] python311Packages.sentry-sdk_2: init at 2.7.1 Exposes `sentry-sdk_1` and `sentry-sdk_2` while defaulting `sentry-sdk` to the 1.x version. --- .../python-modules/sentry-sdk/1.nix | 136 +++++++++++ .../python-modules/sentry-sdk/default.nix | 213 ++++++++++++------ pkgs/top-level/python-packages.nix | 4 +- 3 files changed, 277 insertions(+), 76 deletions(-) create mode 100644 pkgs/development/python-modules/sentry-sdk/1.nix diff --git a/pkgs/development/python-modules/sentry-sdk/1.nix b/pkgs/development/python-modules/sentry-sdk/1.nix new file mode 100644 index 000000000000..3f57549a1e39 --- /dev/null +++ b/pkgs/development/python-modules/sentry-sdk/1.nix @@ -0,0 +1,136 @@ +{ + lib, + stdenv, + aiohttp, + apache-beam, + asttokens, + blinker, + bottle, + buildPythonPackage, + celery, + certifi, + chalice, + django, + executing, + falcon, + fetchFromGitHub, + flask, + gevent, + httpx, + jsonschema, + mock, + pure-eval, + pyrsistent, + pyspark, + pysocks, + pytest-forked, + pytest-localserver, + pytest-watch, + pytestCheckHook, + pythonOlder, + quart, + rq, + sanic, + setuptools, + sqlalchemy, + tornado, + urllib3, +}: + +buildPythonPackage rec { + pname = "sentry-sdk"; + version = "1.45.0"; + pyproject = true; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "getsentry"; + repo = "sentry-python"; + rev = "refs/tags/${version}"; + hash = "sha256-OWoMqJlf0vmBHWWsW6mF4u5X9USzxkFmCJyX7Ws0dD0="; + }; + + build-system = [ setuptools ]; + + dependencies = [ + certifi + urllib3 + ]; + + passthru.optional-dependencies = { + aiohttp = [ aiohttp ]; + beam = [ apache-beam ]; + bottle = [ bottle ]; + celery = [ celery ]; + chalice = [ chalice ]; + django = [ django ]; + falcon = [ falcon ]; + flask = [ + flask + blinker + ]; + httpx = [ httpx ]; + pyspark = [ pyspark ]; + pure_eval = [ + asttokens + executing + pure-eval + ]; + quart = [ + quart + blinker + ]; + rq = [ rq ]; + sanic = [ sanic ]; + sqlalchemy = [ sqlalchemy ]; + tornado = [ tornado ]; + }; + + nativeCheckInputs = [ + asttokens + executing + gevent + jsonschema + mock + pure-eval + pyrsistent + pysocks + pytest-forked + pytest-localserver + pytest-watch + pytestCheckHook + ]; + + doCheck = !stdenv.isDarwin; + + disabledTests = [ + # Issue with the asseration + "test_auto_enabling_integrations_catches_import_error" + "test_default_release" + ]; + + disabledTestPaths = + [ + # Varius integration tests fail every once in a while when we + # upgrade dependencies, so don't bother testing them. + "tests/integrations/" + ] + ++ lib.optionals (stdenv.buildPlatform != "x86_64-linux") [ + # test crashes on aarch64 + "tests/test_transport.py" + ]; + + pythonImportsCheck = [ "sentry_sdk" ]; + + meta = with lib; { + description = "Python SDK for Sentry.io"; + homepage = "https://github.com/getsentry/sentry-python"; + changelog = "https://github.com/getsentry/sentry-python/blob/${version}/CHANGELOG.md"; + license = licenses.bsd2; + maintainers = with maintainers; [ + fab + gebner + ]; + }; +} diff --git a/pkgs/development/python-modules/sentry-sdk/default.nix b/pkgs/development/python-modules/sentry-sdk/default.nix index 3f57549a1e39..3e891a8ad6a5 100644 --- a/pkgs/development/python-modules/sentry-sdk/default.nix +++ b/pkgs/development/python-modules/sentry-sdk/default.nix @@ -1,136 +1,199 @@ -{ - lib, - stdenv, - aiohttp, - apache-beam, - asttokens, - blinker, - bottle, - buildPythonPackage, - celery, - certifi, - chalice, - django, - executing, - falcon, - fetchFromGitHub, - flask, - gevent, - httpx, - jsonschema, - mock, - pure-eval, - pyrsistent, - pyspark, - pysocks, - pytest-forked, - pytest-localserver, - pytest-watch, - pytestCheckHook, - pythonOlder, - quart, - rq, - sanic, - setuptools, - sqlalchemy, - tornado, - urllib3, +{ 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 = "1.45.0"; + version = "2.7.1"; pyproject = true; - disabled = pythonOlder "3.7"; - src = fetchFromGitHub { owner = "getsentry"; repo = "sentry-python"; - rev = "refs/tags/${version}"; - hash = "sha256-OWoMqJlf0vmBHWWsW6mF4u5X9USzxkFmCJyX7Ws0dD0="; + rev = version; + hash = "sha256-MxpG4R6kWozBR5RiSBI/rCSsM2Gv2XJcx8B3IV3LGVk="; }; - build-system = [ setuptools ]; + postPatch = '' + sed -i "/addopts =/d" pytest.ini + ''; + + build-system = [ + setuptools + ]; dependencies = [ certifi urllib3 ]; - passthru.optional-dependencies = { + 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 = [ - flask blinker + flask + markupsafe + ]; + grpcio = [ + grpcio + protobuf ]; httpx = [ httpx ]; - pyspark = [ pyspark ]; + 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 = [ - quart blinker + quart ]; rq = [ rq ]; sanic = [ sanic ]; sqlalchemy = [ sqlalchemy ]; + starlette = [ starlette ]; + # TODO: starlite tornado = [ tornado ]; }; nativeCheckInputs = [ - asttokens - executing - gevent - jsonschema - mock - pure-eval + ipdb pyrsistent + responses pysocks + setuptools + executing + jsonschema + pip + pytest-asyncio pytest-forked pytest-localserver + pytest-xdist pytest-watch pytestCheckHook ]; - doCheck = !stdenv.isDarwin; - disabledTests = [ - # Issue with the asseration - "test_auto_enabling_integrations_catches_import_error" + # 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" ]; - disabledTestPaths = - [ - # Varius integration tests fail every once in a while when we - # upgrade dependencies, so don't bother testing them. - "tests/integrations/" - ] - ++ lib.optionals (stdenv.buildPlatform != "x86_64-linux") [ - # test crashes on aarch64 - "tests/test_transport.py" - ]; - pythonImportsCheck = [ "sentry_sdk" ]; meta = with lib; { - description = "Python SDK for Sentry.io"; + description = "Official Python SDK for Sentry.io"; homepage = "https://github.com/getsentry/sentry-python"; - changelog = "https://github.com/getsentry/sentry-python/blob/${version}/CHANGELOG.md"; - license = licenses.bsd2; - maintainers = with maintainers; [ - fab - gebner - ]; + changelog = "https://github.com/getsentry/sentry-python/blob/${src.rev}/CHANGELOG.md"; + license = licenses.mit; + maintainers = with maintainers; [ hexa ]; }; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 18be7b169ad5..729f73f94e6d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13913,7 +13913,9 @@ self: super: with self; { sentinels = callPackage ../development/python-modules/sentinels { }; - sentry-sdk = callPackage ../development/python-modules/sentry-sdk { }; + sentry-sdk_1 = callPackage ../development/python-modules/sentry-sdk/1.nix { }; + sentry-sdk_2 = callPackage ../development/python-modules/sentry-sdk/default.nix { }; + sentry-sdk = sentry-sdk_1; sepaxml = callPackage ../development/python-modules/sepaxml { };