# Typer | Sentry for Python

The `TyperIntegration` captures exceptions raised when using [Typer CLI](https://typer.tiangolo.com/.md) applications.

## [Install](https://docs.sentry.io/.md#install)

Install Typer and the Sentry Python SDK.

```bash
pip install "sentry-sdk" "typer"
```

## [Configure](https://docs.sentry.io/.md#configure)

To enable the `TyperIntegration`, add it to the `integrations` list of your `sentry_sdk.init`.

```python
import sentry_sdk
from sentry_sdk.integrations.typer import TyperIntegration

sentry_sdk.init(
    dsn="https://examplePublicKey@o0.ingest.sentry.io/0",
    # Add data like request headers and IP for users, if applicable;
    # see https://docs.sentry.io/platforms/python/data-management/data-collected/ for more info
    send_default_pii=True,
    integrations=[TyperIntegration()],
)
```

## [Verify](https://docs.sentry.io/.md#verify)

Create a small CLI application:

```python
import typer
import sentry_sdk
from sentry_sdk.integrations.typer import TyperIntegration

sentry_sdk.init(...)  # see above

def main():
    1 / 0

if __name__ == "__main__":
    typer.run(main)
```

When you run this, Sentry will capture the `ZeroDivisionError` from the `main()` function and you'll be able to see it on [sentry.io](https://sentry.io/.md).
