From efbd977fb10009ae0690abb46680f1fe5d5d7a29 Mon Sep 17 00:00:00 2001 From: Giovanni Barillari Date: Sun, 13 Oct 2024 19:25:39 +0200 Subject: [PATCH] Check `emmett` version, update readme --- README.md | 3 +++ emmett_sentry/_imports.py | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 3aff84f..9800b38 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Emmett-Sentry is an [Emmett framework](https://emmett.sh) extension integrating [Sentry](https://sentry.io) monitoring platform. +Emmett-Sentry is compatible both with Emmett and Emmett55. + ## Installation You can install Emmett-Sentry using pip: @@ -37,6 +39,7 @@ Here is the complete list of parameters of the extension configuration: | trace\_sessions | `True` | Enable tracing on sessions load/store | | trace\_cache | `True` | Enable tracing on cache get/set | | trace\_pipes | `False` | Enable tracing on pipes | +| sdk\_opts | `{}` | Additional configuration for the Sentry SDK | ## Usage diff --git a/emmett_sentry/_imports.py b/emmett_sentry/_imports.py index 6bdb768..f9fac88 100644 --- a/emmett_sentry/_imports.py +++ b/emmett_sentry/_imports.py @@ -1,4 +1,12 @@ try: + from emmett.__version__ import __version__ + + _major, _minor, _ = __version__.split(".") + if _major < 2 or (_major == 2 and _minor < 6): + from .__version__ import __version__ as extver + + raise RuntimeError(f"Emmett-Sentry {extver} requires Emmett >= 2.6.0") + from emmett import current from emmett.extensions import Extension, Signals, listen_signal