core-sentry 2.0.2__tar.gz → 2.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: core-sentry
3
- Version: 2.0.2
3
+ Version: 2.1.1
4
4
  Summary: A thin Python wrapper around the Sentry SDK providing a decorator for automatic initialization and standalone functions for the full event lifecycle.
5
5
  Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
6
6
  Maintainer: Alejandro Cora González
@@ -29,8 +29,8 @@ Description-Content-Type: text/x-rst
29
29
  License-File: LICENSE
30
30
  Requires-Dist: sentry-sdk>=2.29.1
31
31
  Provides-Extra: dev
32
- Requires-Dist: core-dev-tools>=1.2.1; extra == "dev"
33
- Requires-Dist: core-tests>=2.0.1; extra == "dev"
32
+ Requires-Dist: core-dev-tools>=2.1.0; extra == "dev"
33
+ Requires-Dist: core-tests>=2.3.0; extra == "dev"
34
34
  Dynamic: license-file
35
35
 
36
36
  core-sentry
@@ -42,6 +42,10 @@ lifecycle: initialization, exception capture, message capture, and flush.
42
42
 
43
43
  ===============================================================================
44
44
 
45
+ .. image:: https://static.pepy.tech/personalized-badge/core-sentry?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads
46
+ :target: https://pepy.tech/projects/core-sentry
47
+ :alt: PyPI Downloads
48
+
45
49
  .. image:: https://img.shields.io/pypi/pyversions/core-sentry.svg
46
50
  :target: https://pypi.org/project/core-sentry/
47
51
  :alt: Python Versions
@@ -7,6 +7,10 @@ lifecycle: initialization, exception capture, message capture, and flush.
7
7
 
8
8
  ===============================================================================
9
9
 
10
+ .. image:: https://static.pepy.tech/personalized-badge/core-sentry?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads
11
+ :target: https://pepy.tech/projects/core-sentry
12
+ :alt: PyPI Downloads
13
+
10
14
  .. image:: https://img.shields.io/pypi/pyversions/core-sentry.svg
11
15
  :target: https://pypi.org/project/core-sentry/
12
16
  :alt: Python Versions
@@ -1,17 +1,18 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """
4
2
  A thin Python wrapper around the Sentry SDK providing a decorator
5
3
  for automatic initialization and standalone functions for
6
4
  the full event lifecycle.
7
5
  """
8
6
 
9
- from importlib.metadata import PackageNotFoundError
10
- from importlib.metadata import version
11
-
7
+ from importlib.metadata import PackageNotFoundError, version
12
8
 
13
9
  try:
14
10
  __version__ = version("core-sentry")
15
11
 
16
12
  except PackageNotFoundError:
17
13
  __version__ = "unknown"
14
+
15
+
16
+ __all__ = [
17
+ "__version__",
18
+ ]
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """
4
2
  Sentry SDK core primitives.
5
3
 
@@ -41,12 +39,10 @@ Example:
41
39
  ..
42
40
  """
43
41
 
44
- from dataclasses import dataclass
45
- from dataclasses import field
46
- from typing import Any
47
- from typing import Dict
48
- from typing import Literal
49
- from typing import Optional
42
+ from __future__ import annotations
43
+
44
+ from dataclasses import dataclass, field
45
+ from typing import Any, Literal
50
46
 
51
47
  import sentry_sdk
52
48
 
@@ -86,9 +82,9 @@ class SentryConfig:
86
82
 
87
83
  dsn: str
88
84
  env: str
89
- tags: Optional[Dict[str, str]] = None
85
+ tags: dict[str, str] | None = None
90
86
  traces_sample_rate: float = 0.1
91
- options: Dict[str, Any] = field(default_factory=dict)
87
+ options: dict[str, Any] = field(default_factory=dict)
92
88
 
93
89
 
94
90
  def init_sentry(config: SentryConfig) -> None:
@@ -143,9 +139,9 @@ def flush_sentry(timeout: float = 2.0) -> bool:
143
139
 
144
140
  def capture_exception(
145
141
  error: BaseException,
146
- tags: Optional[Dict[str, str]] = None,
147
- extra: Optional[Dict[str, Any]] = None,
148
- ) -> Optional[str]:
142
+ tags: dict[str, str] | None = None,
143
+ extra: dict[str, Any] | None = None,
144
+ ) -> str | None:
149
145
  """
150
146
  Capture an exception and send it to Sentry.
151
147
 
@@ -176,9 +172,9 @@ def capture_exception(
176
172
  def capture_message(
177
173
  message: str,
178
174
  level: Literal["fatal", "critical", "error", "warning", "info", "debug"] = "info",
179
- tags: Optional[Dict[str, str]] = None,
180
- extra: Optional[Dict[str, Any]] = None,
181
- ) -> Optional[str]:
175
+ tags: dict[str, str] | None = None,
176
+ extra: dict[str, Any] | None = None,
177
+ ) -> str | None:
182
178
  """
183
179
  Capture a message and send it to Sentry.
184
180
 
@@ -207,7 +203,7 @@ def capture_message(
207
203
 
208
204
  def _set_tags_to_scope(
209
205
  scope: sentry_sdk.Scope,
210
- tags: Optional[Dict[str, str]] = None,
206
+ tags: dict[str, str] | None = None,
211
207
  ) -> None:
212
208
  if tags:
213
209
  for key, value in tags.items():
@@ -216,7 +212,7 @@ def _set_tags_to_scope(
216
212
 
217
213
  def _set_extras_to_scope(
218
214
  scope: sentry_sdk.Scope,
219
- extra: Optional[Dict[str, Any]] = None,
215
+ extra: dict[str, Any] | None = None,
220
216
  ) -> None:
221
217
  if extra:
222
218
  for key, value in extra.items():
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """
4
2
  Sentry SDK initialization decorators.
5
3
 
@@ -54,8 +52,8 @@ Features:
54
52
  from __future__ import annotations
55
53
 
56
54
  import functools
57
- import typing
58
55
  from dataclasses import dataclass
56
+ from typing import Any, Callable
59
57
 
60
58
  from core_sentry.base import SentryConfig
61
59
  from core_sentry.base import capture_exception as _capture_exception
@@ -105,16 +103,16 @@ class SentryRuntimeConfig:
105
103
  capture_exceptions: bool = False
106
104
  flush: bool = False
107
105
  flush_timeout: float = 2.0
108
- tags: typing.Optional[typing.Dict[str, str]] = None
109
- extra: typing.Optional[typing.Dict[str, typing.Any]] = None
106
+ tags: dict[str, str] | None = None
107
+ extra: dict[str, Any] | None = None
110
108
 
111
109
 
112
110
  def with_sentry(
113
- _func: typing.Optional[typing.Callable] = None,
111
+ _func: Callable | None = None,
114
112
  *,
115
113
  config: SentryConfig,
116
- runtime_config: SentryRuntimeConfig = SentryRuntimeConfig(),
117
- ) -> typing.Callable | typing.Callable[[typing.Callable], typing.Callable]:
114
+ runtime_config: SentryRuntimeConfig | None = None,
115
+ ) -> Callable | Callable[[Callable], Callable]:
118
116
  """
119
117
  Decorator that initializes the Sentry SDK before the wrapped function runs.
120
118
 
@@ -168,7 +166,10 @@ def with_sentry(
168
166
  running and where per-invocation tags and extra context matter.
169
167
  """
170
168
 
171
- def decorator(func: typing.Callable) -> typing.Callable:
169
+ if runtime_config is None:
170
+ runtime_config = SentryRuntimeConfig()
171
+
172
+ def decorator(func: Callable) -> Callable:
172
173
  @functools.wraps(func)
173
174
  def wrapper(*args, **kwargs):
174
175
  _init_sentry(config)
@@ -1,5 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  """
4
2
  Base test utilities for Sentry SDK integration testing.
5
3
 
@@ -47,7 +45,7 @@ from unittest.mock import patch
47
45
 
48
46
 
49
47
  class BaseSentryTestCases(TestCase):
50
- """ Base class for Test Cases related to Sentry integration """
48
+ """Base class for Test Cases related to Sentry integration"""
51
49
 
52
50
  sentry_patcher = patch(target="sentry_sdk.init")
53
51
  sentry_mock = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: core-sentry
3
- Version: 2.0.2
3
+ Version: 2.1.1
4
4
  Summary: A thin Python wrapper around the Sentry SDK providing a decorator for automatic initialization and standalone functions for the full event lifecycle.
5
5
  Author-email: Alejandro Cora González <alek.cora.glez@gmail.com>
6
6
  Maintainer: Alejandro Cora González
@@ -29,8 +29,8 @@ Description-Content-Type: text/x-rst
29
29
  License-File: LICENSE
30
30
  Requires-Dist: sentry-sdk>=2.29.1
31
31
  Provides-Extra: dev
32
- Requires-Dist: core-dev-tools>=1.2.1; extra == "dev"
33
- Requires-Dist: core-tests>=2.0.1; extra == "dev"
32
+ Requires-Dist: core-dev-tools>=2.1.0; extra == "dev"
33
+ Requires-Dist: core-tests>=2.3.0; extra == "dev"
34
34
  Dynamic: license-file
35
35
 
36
36
  core-sentry
@@ -42,6 +42,10 @@ lifecycle: initialization, exception capture, message capture, and flush.
42
42
 
43
43
  ===============================================================================
44
44
 
45
+ .. image:: https://static.pepy.tech/personalized-badge/core-sentry?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads
46
+ :target: https://pepy.tech/projects/core-sentry
47
+ :alt: PyPI Downloads
48
+
45
49
  .. image:: https://img.shields.io/pypi/pyversions/core-sentry.svg
46
50
  :target: https://pypi.org/project/core-sentry/
47
51
  :alt: Python Versions
@@ -0,0 +1,5 @@
1
+ sentry-sdk>=2.29.1
2
+
3
+ [dev]
4
+ core-dev-tools>=2.1.0
5
+ core-tests>=2.3.0
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
9
9
  [project]
10
10
  name = "core-sentry"
11
11
  description = "A thin Python wrapper around the Sentry SDK providing a decorator for automatic initialization and standalone functions for the full event lifecycle."
12
- version = "2.0.2"
12
+ version = "2.1.1"
13
13
 
14
14
  authors = [
15
15
  {name = "Alejandro Cora González", email = "alek.cora.glez@gmail.com"}
@@ -47,8 +47,8 @@ dependencies = [
47
47
 
48
48
  [project.optional-dependencies]
49
49
  dev = [
50
- "core-dev-tools>=1.2.1",
51
- "core-tests>=2.0.1",
50
+ "core-dev-tools>=2.1.0",
51
+ "core-tests>=2.3.0",
52
52
  ]
53
53
 
54
54
  [project.urls]
@@ -1,6 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
-
3
1
  from setuptools import setup
4
2
 
5
-
6
3
  setup()
@@ -1,5 +0,0 @@
1
- sentry-sdk>=2.29.1
2
-
3
- [dev]
4
- core-dev-tools>=1.2.1
5
- core-tests>=2.0.1
File without changes
File without changes