diff --git a/docs/platforms/python/integrations/index.mdx b/docs/platforms/python/integrations/index.mdx index b306e5dcc0164..177163d2a0922 100644 --- a/docs/platforms/python/integrations/index.mdx +++ b/docs/platforms/python/integrations/index.mdx @@ -116,10 +116,11 @@ The Sentry SDK uses integrations to hook into the functionality of popular libra | | | | | | | | | -| | | +| | | | | | | | | | | | +| | | | | | ### Default Integrations diff --git a/docs/platforms/python/integrations/typer/index.mdx b/docs/platforms/python/integrations/typer/index.mdx new file mode 100644 index 0000000000000..4498490d6f3f0 --- /dev/null +++ b/docs/platforms/python/integrations/typer/index.mdx @@ -0,0 +1,52 @@ +--- +title: Typer +description: Learn how to use Sentry to capture Typer exceptions. +--- + +The `TyperIntegration` captures exceptions raised when using [Typer CLI](https://typer.tiangolo.com/) applications. + +## Install + +Install Typer and the Sentry Python SDK. + +```bash +pip install --upgrade "sentry-sdk" typer +``` + +## 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="___PUBLIC_DSN___", + integrations=[TyperIntegration()], +) +``` + +## Verify + +Create a small CLI application: + +```python +import typer +import sentry_sdk +from sentry_sdk.integrations.typer import TyperIntegration + +sentry_sdk.init( + dsn="___PUBLIC_DSN___", + integrations=[TyperIntegration()], +) + +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).