---
title: "pure_eval"
description: "Learn about pure_eval and how to add it to your integrations list."
url: https://docs.sentry.io/platforms/python/integrations/pure_eval/
---

# pure\_eval | Sentry for Python

This integration uses [`pure_eval`](https://github.com/alexmojaki/pure_eval) to safely evaluate additional expressions in the source code and display their values alongside other local variables.

## [Install](https://docs.sentry.io/platforms/python/integrations/pure_eval.md#install)

Install `sentry-sdk` from PyPI with the `pure_eval` extra or `pip install pure_eval executing asttokens`.

```bash
pip install "sentry-sdk[pure_eval]"
```

## [Configure](https://docs.sentry.io/platforms/python/integrations/pure_eval.md#configure)

Add `PureEvalIntegration()` to your `integrations` list:

```python
import sentry_sdk
from sentry_sdk.integrations.pure_eval import PureEvalIntegration

sentry_sdk.init(
    dns="___PUBLIC_DSN___",
    # 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=[
        PureEvalIntegration(),
    ],
)
```

## [Verify](https://docs.sentry.io/platforms/python/integrations/pure_eval.md#verify)

```python
from types import SimpleNamespace

def main():
    sentry_sdk.init(...)  # same as above

    namespace = SimpleNamespace()
    namespace.d = {1: 2}
    print(namespace.d[1] / 0)

main()
```

When you run this example script an error will be sent to Sentry. Through the `PureEvalIntegration` the stack trace of the error will include the values of `namespace.d` and `namespace.d[1]` which would not be shown without `PureEvalIntegration`.

## [Supported Versions](https://docs.sentry.io/platforms/python/integrations/pure_eval.md#supported-versions)

* Python: 3.6+

The versions above apply for the current major version of the Python SDK. If you're looking to use Sentry with older Python or framework versions, consider using an older major version of the SDK.
