%global _empty_manifest_terminate_build 0
Name: python-sentry-asgi
Version: 0.2.0
Release: 1
Summary: Sentry integration for ASGI frameworks.
License: BSD
URL: https://github.com/encode/sentry-asgi
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/2b/94/7ea097693d638359ed91bb981438e6a0b4a26668660101a62683779ced4b/sentry-asgi-0.2.0.tar.gz
BuildArch: noarch
%description
# sentry-asgi
Sentry integration for ASGI frameworks.
Installation:
```shell
pip install sentry-asgi
```
Usage:
```python
from sentry_asgi import SentryMiddleware
import sentry_sdk
sentry_sdk.init(dsn=...)
app = ...
app = SentryMiddleware(app)
```
Here's a more complete example, using Starlette:
```python
import sentry_sdk
from sentry_asgi import SentryMiddleware
sentry_sdk.init(dsn=...)
app = Starlette()
@app.route("/")
def homepage(request):
raise ValueError("nope")
app.add_middleware(SentryMiddleware)
```
## Notes
### Python version support
The Sentry SDK requires Python 3.7's `contextvars` support in order to properly
tie messages and logging back to the request context that is added SentryMiddleware.
On 3.6 and below the SentryMiddleware will capture and log application exceptions just fine,
but will not properly tie in logging, messages, or breadcrumbs for any code that
runs within a threadpool executor or subtask.
ASGI frameworks should ensure that any thread pool executors [preserve the `contextvar` context](https://github.com/django/asgiref/issues/71).
### Endpoint information
It is recommended that frameworks populate an "endpoint" key in the ASGI scope,
to indicate which view function or class should be logged by the middleware.
%package -n python3-sentry-asgi
Summary: Sentry integration for ASGI frameworks.
Provides: python-sentry-asgi
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-sentry-asgi
# sentry-asgi
Sentry integration for ASGI frameworks.
Installation:
```shell
pip install sentry-asgi
```
Usage:
```python
from sentry_asgi import SentryMiddleware
import sentry_sdk
sentry_sdk.init(dsn=...)
app = ...
app = SentryMiddleware(app)
```
Here's a more complete example, using Starlette:
```python
import sentry_sdk
from sentry_asgi import SentryMiddleware
sentry_sdk.init(dsn=...)
app = Starlette()
@app.route("/")
def homepage(request):
raise ValueError("nope")
app.add_middleware(SentryMiddleware)
```
## Notes
### Python version support
The Sentry SDK requires Python 3.7's `contextvars` support in order to properly
tie messages and logging back to the request context that is added SentryMiddleware.
On 3.6 and below the SentryMiddleware will capture and log application exceptions just fine,
but will not properly tie in logging, messages, or breadcrumbs for any code that
runs within a threadpool executor or subtask.
ASGI frameworks should ensure that any thread pool executors [preserve the `contextvar` context](https://github.com/django/asgiref/issues/71).
### Endpoint information
It is recommended that frameworks populate an "endpoint" key in the ASGI scope,
to indicate which view function or class should be logged by the middleware.
%package help
Summary: Development documents and examples for sentry-asgi
Provides: python3-sentry-asgi-doc
%description help
# sentry-asgi
Sentry integration for ASGI frameworks.
Installation:
```shell
pip install sentry-asgi
```
Usage:
```python
from sentry_asgi import SentryMiddleware
import sentry_sdk
sentry_sdk.init(dsn=...)
app = ...
app = SentryMiddleware(app)
```
Here's a more complete example, using Starlette:
```python
import sentry_sdk
from sentry_asgi import SentryMiddleware
sentry_sdk.init(dsn=...)
app = Starlette()
@app.route("/")
def homepage(request):
raise ValueError("nope")
app.add_middleware(SentryMiddleware)
```
## Notes
### Python version support
The Sentry SDK requires Python 3.7's `contextvars` support in order to properly
tie messages and logging back to the request context that is added SentryMiddleware.
On 3.6 and below the SentryMiddleware will capture and log application exceptions just fine,
but will not properly tie in logging, messages, or breadcrumbs for any code that
runs within a threadpool executor or subtask.
ASGI frameworks should ensure that any thread pool executors [preserve the `contextvar` context](https://github.com/django/asgiref/issues/71).
### Endpoint information
It is recommended that frameworks populate an "endpoint" key in the ASGI scope,
to indicate which view function or class should be logged by the middleware.
%prep
%autosetup -n sentry-asgi-0.2.0
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-sentry-asgi -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue Apr 25 2023 Python_Bot - 0.2.0-1
- Package Spec generated