bugstack 1.0.0__tar.gz → 1.1.0__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.
Files changed (40) hide show
  1. {bugstack-1.0.0 → bugstack-1.1.0}/CHANGELOG.md +17 -0
  2. {bugstack-1.0.0 → bugstack-1.1.0}/PKG-INFO +2 -1
  3. {bugstack-1.0.0 → bugstack-1.1.0}/pyproject.toml +2 -1
  4. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/client.py +8 -1
  5. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/transport.py +35 -8
  6. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/types.py +1 -1
  7. {bugstack-1.0.0 → bugstack-1.1.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  8. {bugstack-1.0.0 → bugstack-1.1.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  9. {bugstack-1.0.0 → bugstack-1.1.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  10. {bugstack-1.0.0 → bugstack-1.1.0}/.github/workflows/ci.yml +0 -0
  11. {bugstack-1.0.0 → bugstack-1.1.0}/.github/workflows/publish.yml +0 -0
  12. {bugstack-1.0.0 → bugstack-1.1.0}/.gitignore +0 -0
  13. {bugstack-1.0.0 → bugstack-1.1.0}/CONTRIBUTING.md +0 -0
  14. {bugstack-1.0.0 → bugstack-1.1.0}/LICENSE +0 -0
  15. {bugstack-1.0.0 → bugstack-1.1.0}/README.md +0 -0
  16. {bugstack-1.0.0 → bugstack-1.1.0}/SECURITY.md +0 -0
  17. {bugstack-1.0.0 → bugstack-1.1.0}/examples/basic_usage.py +0 -0
  18. {bugstack-1.0.0 → bugstack-1.1.0}/examples/django_example/settings.py +0 -0
  19. {bugstack-1.0.0 → bugstack-1.1.0}/examples/fastapi_example/main.py +0 -0
  20. {bugstack-1.0.0 → bugstack-1.1.0}/examples/flask_example/main.py +0 -0
  21. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/__init__.py +0 -0
  22. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/fingerprint.py +0 -0
  23. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/integrations/__init__.py +0 -0
  24. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/integrations/django.py +0 -0
  25. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/integrations/fastapi.py +0 -0
  26. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/integrations/flask.py +0 -0
  27. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/integrations/generic.py +0 -0
  28. {bugstack-1.0.0 → bugstack-1.1.0}/src/bugstack/py.typed +0 -0
  29. {bugstack-1.0.0 → bugstack-1.1.0}/tests/conftest.py +0 -0
  30. {bugstack-1.0.0 → bugstack-1.1.0}/tests/helpers.py +0 -0
  31. {bugstack-1.0.0 → bugstack-1.1.0}/tests/integrations/django_settings.py +0 -0
  32. {bugstack-1.0.0 → bugstack-1.1.0}/tests/integrations/test_django.py +0 -0
  33. {bugstack-1.0.0 → bugstack-1.1.0}/tests/integrations/test_fastapi.py +0 -0
  34. {bugstack-1.0.0 → bugstack-1.1.0}/tests/integrations/test_flask.py +0 -0
  35. {bugstack-1.0.0 → bugstack-1.1.0}/tests/integrations/test_generic.py +0 -0
  36. {bugstack-1.0.0 → bugstack-1.1.0}/tests/test_client.py +0 -0
  37. {bugstack-1.0.0 → bugstack-1.1.0}/tests/test_fingerprint.py +0 -0
  38. {bugstack-1.0.0 → bugstack-1.1.0}/tests/test_init.py +0 -0
  39. {bugstack-1.0.0 → bugstack-1.1.0}/tests/test_transport.py +0 -0
  40. {bugstack-1.0.0 → bugstack-1.1.0}/tests/test_types.py +0 -0
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.1.0] - 2026-03-02
6
+
7
+ ### Fixed
8
+
9
+ - **Fork-safe transport**: Background worker thread now automatically restarts
10
+ after `os.fork()`, fixing silent event loss under Gunicorn, uWSGI, and other
11
+ prefork WSGI servers.
12
+ - **Worker loop resilience**: Unexpected exceptions in the worker loop are now
13
+ caught and logged instead of silently killing the thread.
14
+ - **Debug logging under WSGI servers**: Replaced `logging.basicConfig()` (which
15
+ is a no-op when the root logger is already configured by Gunicorn/uWSGI) with
16
+ a direct handler on the `bugstack` logger.
17
+
18
+ ### Added
19
+
20
+ - Python 3.14 support (tested and confirmed).
21
+
5
22
  ## [1.0.0] - 2026-02-13
6
23
 
7
24
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bugstack
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: Official BugStack SDK for Python — capture, report, and auto-fix production errors.
5
5
  Project-URL: Homepage, https://bugstack.dev
6
6
  Project-URL: Documentation, https://docs.bugstack.dev/sdks/python
@@ -20,6 +20,7 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
23
24
  Classifier: Topic :: Software Development :: Bug Tracking
24
25
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
26
  Classifier: Typing :: Typed
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "bugstack"
7
- version = "1.0.0"
7
+ version = "1.1.0"
8
8
  description = "Official BugStack SDK for Python — capture, report, and auto-fix production errors."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -23,6 +23,7 @@ classifiers = [
23
23
  "Programming Language :: Python :: 3.11",
24
24
  "Programming Language :: Python :: 3.12",
25
25
  "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
26
27
  "Topic :: Software Development :: Bug Tracking",
27
28
  "Topic :: Software Development :: Libraries :: Python Modules",
28
29
  "Typing :: Typed",
@@ -41,7 +41,14 @@ class BugStackClient:
41
41
  )
42
42
 
43
43
  if config.debug:
44
- logging.basicConfig(level=logging.DEBUG)
44
+ # Attach a handler directly to the bugstack logger so debug
45
+ # output is visible even when a WSGI server (e.g. Gunicorn)
46
+ # has already configured the root logger (making basicConfig a no-op).
47
+ if not logger.handlers:
48
+ handler = logging.StreamHandler(sys.stderr)
49
+ handler.setFormatter(logging.Formatter("%(name)s - %(levelname)s - %(message)s"))
50
+ logger.addHandler(handler)
51
+ logger.setLevel(logging.DEBUG)
45
52
  logger.debug(
46
53
  "[BugStack] Client initialized (endpoint=%s, dry_run=%s)",
47
54
  config.endpoint,
@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
  import asyncio
6
6
  import json
7
7
  import logging
8
+ import os
8
9
  import threading
9
10
  import time
10
11
  from typing import Any, Optional
@@ -53,6 +54,7 @@ class Transport:
53
54
  self._queue: list[dict[str, Any]] = []
54
55
  self._queue_lock = threading.Lock()
55
56
  self._stop_event = threading.Event()
57
+ self._owner_pid = os.getpid()
56
58
  self._start_worker()
57
59
 
58
60
  def _start_worker(self) -> None:
@@ -67,19 +69,44 @@ class Transport:
67
69
  def _worker_loop(self) -> None:
68
70
  """Process queued events in the background."""
69
71
  while not self._stop_event.is_set():
70
- payloads: list[dict[str, Any]] = []
71
- with self._queue_lock:
72
- if self._queue:
73
- payloads = self._queue[:]
74
- self._queue.clear()
75
-
76
- for payload in payloads:
77
- self._send_with_retry(payload)
72
+ try:
73
+ payloads: list[dict[str, Any]] = []
74
+ with self._queue_lock:
75
+ if self._queue:
76
+ payloads = self._queue[:]
77
+ self._queue.clear()
78
+
79
+ for payload in payloads:
80
+ self._send_with_retry(payload)
81
+ except Exception as exc:
82
+ if self._debug:
83
+ logger.warning("[BugStack] Worker loop error: %s", exc)
78
84
 
79
85
  self._stop_event.wait(timeout=0.5)
80
86
 
87
+ def _ensure_worker_alive(self) -> None:
88
+ """Restart the worker thread if it died (e.g. after os.fork in Gunicorn)."""
89
+ current_pid = os.getpid()
90
+ if current_pid != self._owner_pid:
91
+ # We're in a forked child — reset state and start fresh
92
+ if self._debug:
93
+ logger.debug(
94
+ "[BugStack] Fork detected (pid %d -> %d), restarting worker",
95
+ self._owner_pid, current_pid,
96
+ )
97
+ self._owner_pid = current_pid
98
+ self._stop_event = threading.Event()
99
+ self._queue_lock = threading.Lock()
100
+ self._start_worker()
101
+ elif self._worker_thread is None or not self._worker_thread.is_alive():
102
+ if self._debug:
103
+ logger.debug("[BugStack] Worker thread dead, restarting")
104
+ self._stop_event.clear()
105
+ self._start_worker()
106
+
81
107
  def enqueue(self, payload: dict[str, Any]) -> None:
82
108
  """Add a payload to the send queue (non-blocking)."""
109
+ self._ensure_worker_alive()
83
110
  with self._queue_lock:
84
111
  # Bound the queue to prevent unbounded memory growth
85
112
  if len(self._queue) < 100:
@@ -7,7 +7,7 @@ import sys
7
7
  from dataclasses import dataclass, field
8
8
  from typing import Any, Callable, Optional, Union
9
9
 
10
- SDK_VERSION = "1.0.0"
10
+ SDK_VERSION = "1.1.0"
11
11
 
12
12
 
13
13
  @dataclass
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes