Skip to main content

Official BugStack SDK for Python — capture, report, and auto-fix production errors.

Project description

bugstack-python

Official Python SDK for BugStack — capture, report, and auto-fix production errors.

PyPI Python License: MIT

Installation

pip install bugstack

Quick Start

import bugstack

bugstack.init(api_key="bs_live_...")

try:
    risky_operation()
except Exception as e:
    bugstack.capture_exception(e)

Framework Integrations

FastAPI

from fastapi import FastAPI
from bugstack.integrations.fastapi import FastAPIMiddleware

app = FastAPI()
app.add_middleware(FastAPIMiddleware)

bugstack.init(api_key="bs_live_...")

Django

# settings.py
MIDDLEWARE = [
    'bugstack.integrations.django.BugStackMiddleware',
    # ... other middleware
]

BUGSTACK_API_KEY = "bs_live_..."
BUGSTACK_AUTO_FIX = True  # optional

Flask

from flask import Flask
from bugstack.integrations.flask import init_app

app = Flask(__name__)
bugstack.init(api_key="bs_live_...")
init_app(app)

Generic (sys.excepthook)

from bugstack.integrations.generic import install_hooks

bugstack.init(api_key="bs_live_...")
install_hooks()

Configuration

bugstack.init(
    api_key="bs_live_...",          # Required
    environment="production",       # Default: "production"
    auto_fix=True,                  # Enable AI-powered auto-fix
    debug=False,                    # Log SDK activity
    dry_run=False,                  # Log without sending
    enabled=True,                   # Kill switch
    deduplication_window=300,       # Seconds (default: 5 min)
    timeout=5.0,                    # HTTP timeout in seconds
    max_retries=3,                  # Retry attempts
    ignored_errors=[                # Errors to skip
        KeyboardInterrupt,
        "expected error message",
    ],
    before_send=my_hook,            # Inspect/modify/drop events
    redact_fields=["password"],     # Fields to redact
)

Data Transparency

before_send Hook

Inspect, modify, or drop any event before it leaves your application:

def before_send(event):
    # Drop health check errors
    if "health" in event.request.route:
        return None

    # Redact sensitive data
    event.metadata.pop("secret", None)

    return event

bugstack.init(api_key="bs_live_...", before_send=before_send)

ignored_errors

Skip specific error types or messages:

bugstack.init(
    api_key="bs_live_...",
    ignored_errors=[
        KeyboardInterrupt,          # By type
        SystemExit,                 # By type
        "Connection reset",         # By exact message
    ],
)

dry_run Mode

See exactly what would be sent without making any network requests:

bugstack.init(api_key="bs_live_...", dry_run=True)
# Prints: [BugStack DryRun] Would send: { ... }

What Gets Sent

Every error event contains exactly this — nothing more:

{
  "apiKey": "bs_live_...",
  "error": {
    "message": "division by zero",
    "stackTrace": "Traceback (most recent call last)...",
    "file": "app/api/handler.py",
    "function": "process_request",
    "fingerprint": "a1b2c3d4e5f6g7h8"
  },
  "environment": {
    "language": "python",
    "languageVersion": "3.12.1",
    "framework": "fastapi",
    "frameworkVersion": "0.109.0",
    "os": "linux",
    "sdkVersion": "1.0.0"
  },
  "timestamp": "2026-01-15T08:30:00+00:00"
}

No cookies. No IP addresses. No user data. No request bodies (unless you explicitly include them).

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bugstack-1.0.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bugstack-1.0.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file bugstack-1.0.0.tar.gz.

File metadata

  • Download URL: bugstack-1.0.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for bugstack-1.0.0.tar.gz
Algorithm Hash digest
SHA256 36b68f41d8704a5bf8f127bb759ae6ae129b820d51d37776a2b61b56809cc222
MD5 6b0313680f3cc92b834977c8ca04512d
BLAKE2b-256 d2803a1082bb02a323d81eb9d640a42db2c95bad284cba4d1a1eaaeb9e60413a

See more details on using hashes here.

File details

Details for the file bugstack-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bugstack-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for bugstack-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d6d609762a30871814c4060415ade0e3be5ca7e803ec6d7c7e7e701570eec69
MD5 4a88f7d4eaa7ab0bb2aa0ff6827dd15b
BLAKE2b-256 d1e6bb5e0f3c79f9f3de0bac45ec82f3b4807c074b085f978b2b7ab175838897

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page