Metadata-Version: 2.4
Name: philiprehberger-stacktrace
Version: 0.1.2
Summary: Turn Python stack traces into cleaner, more readable output
Project-URL: Homepage, https://github.com/philiprehberger/py-stacktrace#readme
Project-URL: Repository, https://github.com/philiprehberger/py-stacktrace
Project-URL: Issues, https://github.com/philiprehberger/py-stacktrace/issues
Project-URL: Changelog, https://github.com/philiprehberger/py-stacktrace/blob/main/CHANGELOG.md
Author: Philip Rehberger
License-Expression: MIT
License-File: LICENSE
Keywords: debug,error,exception,stacktrace,traceback
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# philiprehberger-stacktrace

[![Tests](https://github.com/philiprehberger/py-stacktrace/actions/workflows/publish.yml/badge.svg)](https://github.com/philiprehberger/py-stacktrace/actions/workflows/publish.yml)
[![PyPI version](https://img.shields.io/pypi/v/philiprehberger-stacktrace.svg)](https://pypi.org/project/philiprehberger-stacktrace/)
[![License](https://img.shields.io/github/license/philiprehberger/py-stacktrace)](LICENSE)

Turn Python stack traces into cleaner, more readable output.

## Installation

```bash
pip install philiprehberger-stacktrace
```

## Usage

### Global Install

```python
from philiprehberger_stacktrace import install

install()  # replaces sys.excepthook
```

### Manual Formatting

```python
from philiprehberger_stacktrace import format_exception

try:
    risky_operation()
except Exception as e:
    report = format_exception(e)
    print(report.short())     # one-line summary
    print(report.detailed())  # colored with source context
```

### Features

- Colored output with syntax highlighting
- Source context lines around the error
- Hides stdlib/site-packages frames by default
- Exception chain display (`raise ... from ...`)
- One-line summary mode

## API

- `install(color=True, context=2, hide_stdlib=True)` — Replace `sys.excepthook`
- `format_exception(exc)` — Returns `ExceptionReport`
- `report.short()` — One-line summary
- `report.detailed(color, context, hide_stdlib)` — Full formatted output

## License

MIT
