Metadata-Version: 2.4
Name: bugnet-sdk
Version: 1.0.0
Summary: Bugnet SDK for Pygame — bug reporting, crash analytics, and session replay for Python games
Author-email: Bugnet <contact@bugnet.io>
License: MIT
Project-URL: Homepage, https://bugnet.io
Project-URL: Documentation, https://bugnet.io/docs
Project-URL: Repository, https://github.com/threadsoftware/bugnet
Project-URL: Bug Tracker, https://bugnet.io
Project-URL: Pygame SDK, https://bugnet.io/for/pygame/
Keywords: bugnet,pygame,bug-reporting,crash-analytics,game-development,error-tracking
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Games/Entertainment
Classifier: Topic :: Software Development :: Bug Tracking
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pygame>=2.0.0
Provides-Extra: memory
Requires-Dist: psutil; extra == "memory"
Dynamic: license-file

# Bugnet SDK for Pygame

A lightweight bug reporting and crash analytics SDK for Pygame games. Enables manual bug reports, automatic crash capture, screenshot capture, session replay, and performance profiling.

## Installation

```bash
pip install bugnet-sdk
```

For memory usage reporting, install with the optional `psutil` dependency:

```bash
pip install bugnet-sdk[memory]
```

## Quick Start

```python
import pygame
import bugnet_sdk

pygame.init()
screen = pygame.display.set_mode((800, 600))

# Initialize the SDK with your API key
bugnet_sdk.init("sk_live_YOUR_KEY", "https://api.bugnet.io")

clock = pygame.time.Clock()
running = True
while running:
    dt = clock.tick(60)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == pygame.KEYDOWN and event.key == pygame.K_F1:
            bugnet_sdk.show_widget()
        bugnet_sdk.handle_event(event)

    bugnet_sdk.update(screen, clock)
    # ... your rendering ...
    pygame.display.flip()

bugnet_sdk.shutdown()
```

## Features

- **Automatic crash capture** — Unhandled exceptions are reported with full stack traces
- **In-game widget** — Players can file bug reports without leaving the game
- **Screenshot capture** — Automatic screenshots attached to error reports
- **Session replay** — Records mouse and keyboard input for replay
- **Performance profiling** — FPS, frame time, and memory usage snapshots
- **Freeze detection** — Auto-reports when a frame exceeds 2 seconds
- **Scene load tracking** — Track load times for levels and scenes
- **Log capture** — Recent stdout output attached to bug reports

## API Reference

| Function | Description |
|----------|-------------|
| `init(api_key, server_url, auto_capture, game_version)` | Initialize the SDK |
| `report_bug(title, description, ...)` | Submit a manual bug report |
| `report_error(message, stack)` | Report an error/exception |
| `handle_event(event)` | Pass pygame events for replay and widget |
| `update(screen, clock)` | Call per-frame for metrics and widget |
| `show_widget()` / `hide_widget()` | Toggle the in-game report overlay |
| `set_player(steam_id, player_name)` | Set player identity |
| `scene_load_start(name)` / `scene_load_end(name)` | Track scene load times |
| `shutdown()` | Clean up before quitting |

## Documentation

Full documentation: [https://bugnet.io/docs](https://bugnet.io/docs)

Pygame SDK page: [https://bugnet.io/for/pygame/](https://bugnet.io/for/pygame/)

## License

MIT
