Skip to main content

Auto cache and track Python exceptions via Python decorators.

Project description

Bug Buddy

Bug Buddy helps you take action on exceptions in your code.

Too often do we encounter bugs in our code that are not properly managed and fixed. Prescribing to the notion that code is in an ever-improving state, Bug Buddy helps developers track both high-frequency and one-off bugs by autocaching locally and uploading to an issue tracker so they may be linked to appropriate update branches.

Bug Buddy works best when paired with pytest or unittest to automatically create issues for each test failure encountered during CI/CD.

Bug Buddy works with the following issue trackers:

  • Gitlab
  • Github
  • Linear

Installation

Version Packaged with Poetry pre-commit Code style: black Ruff

You can install Bug Buddy using pip:

pip install bug-buddy

Usage

Set the API token for where you'd like to track issues.

Remote Env Variable
Linear $LINEAR_API_KEY
Gitlab $GITLAB_TOKEN
Github $GITHUB_TOKEN

To use Bug Buddy, you need only to import it and decorate the top-level callable of your code with @bug_buddy:

import pandas as pd
from bug_buddy import bug_buddy, LinearIntegration

integration = LinearIntegration(
    team_id=<linear_team_id>,
    project_id=<linear_project_id>,
)

@bug_buddy(integration=integration)
def test_fail() -> None:

    raise Exception("test")
  • Running this code, Bug Buddy returns the exception traceback just as you'd normally expect.
pytest
  • stdout will show the pytest output just as you'd normally expect.

alt text

  • As requested in @bug_buddy, the issue is logged to Linear
  • If run in Github Actions or Gitlab CI, it will also log CI environment variables to the issue report.

alt text

In addition to the remote, the issue is cached to $HOME/.bug_buddy.cache, to enable offline bug tracking.

{
    "id": "<issue_id>",
    "title": "BugBuddy-test_fail-910b6168-d34c-4471-9b1f-2000aead110d",
    "state": "Triage",
    "project_id": "<project_id>",
    "author": "Spencer Seale",
    "created_at": "2026-01-30T17:13:57.022Z",
    "updated_at": "2026-01-30T17:13:57.022Z",
    "description": "### Function\n\n```python\n@bug_buddy(integration=integration)\ndef test_fail():\n    print(\"failing\")\n    raise Exception(\"test\")\n```\n\n### Source\n\n| Property | Value |\n| -- | -- |\n| Timestamp | `2026-01-30 17:13:56 UTC` |\n| Platform | `macOS-14.4.1-arm64-arm-64bit` |\n| Python | `3.11.14` |\n| Working Directory | `/Users/spencerseale/personal/bugbuddy` |\n| User | `spencerseale` |\n\n### Traceback\n\n| File | Callable | Line | Code |\n| -- | -- | -- | -- |\n| /Users/spencerseale/personal/bugbuddy/insp.py | test_fail | 15 | raise Exception(\"test\") |\n\n### Raw traceback\n\n```\nTraceback (most recent call last):\n  File \"/Users/spencerseale/personal/bugbuddy/src/python/bug_buddy/bb.py\", line 42, in wrapper\n    actual = runner(*args, **kwargs)\n             ^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/Users/spencerseale/personal/bugbuddy/insp.py\", line 15, in test_fail\n    raise Exception(\"test\")\nException: test\n```",
    "labels": "Bug"
}

Parameters

The @bug_buddy decorator connects to the issue tracker of your choice by passing the appropriate integration:

  • GitlabIntegration
  • GithubIntegration
  • LinearIntegration

Contribute

Contributions are welcome! Please feel free to contribute at https://github.com/spencerseale/bugbuddy

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

bug_buddy-1.1.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

bug_buddy-1.1.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file bug_buddy-1.1.0.tar.gz.

File metadata

  • Download URL: bug_buddy-1.1.0.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bug_buddy-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cc21a1885eb0d7375249fcb2c24a8d488b0d48584a713b0e19f753493fe37759
MD5 1db480f7191adfc4ea39037d3539a3d4
BLAKE2b-256 97e7ca1f04f09050e214628412e6fff702d989ebe3eb1632529c1ec18eda8e05

See more details on using hashes here.

Provenance

The following attestation bundles were made for bug_buddy-1.1.0.tar.gz:

Publisher: release.yml on spencerseale/bugbuddy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bug_buddy-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: bug_buddy-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bug_buddy-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78662b9e6ecc6fe46e1006e73ca430b90410f49259e5a2ba941e6d1ec0da3195
MD5 8b9822a0b9d1ebb61e383ce6cda2398e
BLAKE2b-256 7eb368dae3d503623a76b24034d3fb6a60e6b6b7457c6e71fdb0e68c8e6b7a93

See more details on using hashes here.

Provenance

The following attestation bundles were made for bug_buddy-1.1.0-py3-none-any.whl:

Publisher: release.yml on spencerseale/bugbuddy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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