diff options
-rw-r--r-- | .github/workflows/run_tests.yml | 2 | ||||
-rw-r--r-- | .github/workflows/upload-to-pypi.yml | 2 | ||||
-rw-r--r-- | pyproject.toml | 2 | ||||
-rw-r--r-- | src/jinjax/catalog.py | 1 | ||||
-rw-r--r-- | src/jinjax/middleware.py | 15 |
5 files changed, 11 insertions, 11 deletions
diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 27b9040..fa73a53 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -22,7 +22,7 @@ jobs: name: tests strategy: matrix: - python: ["3.10", "3.11", "3.12"] + python: ["3.10", "3.11", "3.12", "3.13"] fail-fast: false runs-on: ubuntu-latest steps: diff --git a/.github/workflows/upload-to-pypi.yml b/.github/workflows/upload-to-pypi.yml index 2503665..99e8d48 100644 --- a/.github/workflows/upload-to-pypi.yml +++ b/.github/workflows/upload-to-pypi.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: 3.12 - name: "Installs dependencies" run: | diff --git a/pyproject.toml b/pyproject.toml index d38a070..f4d1b54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "jinjax" -version = "0.46" +version = "0.48" description = "Replace your HTML templates with Python server-Side components" authors = ["Juan-Pablo Scaletti <juanpablo@jpscaletti.com>"] license = "MIT" diff --git a/src/jinjax/catalog.py b/src/jinjax/catalog.py index 7728ed4..6cb2b70 100644 --- a/src/jinjax/catalog.py +++ b/src/jinjax/catalog.py @@ -12,7 +12,6 @@ from .component import Component from .exceptions import ComponentNotFound, InvalidArgument from .html_attrs import HTMLAttrs from .jinjax import JinjaX -from .middleware import ComponentsMiddleware from .utils import DELIMITER, SLASH, get_url_prefix, logger diff --git a/src/jinjax/middleware.py b/src/jinjax/middleware.py index af430b1..4e8c52e 100644 --- a/src/jinjax/middleware.py +++ b/src/jinjax/middleware.py @@ -6,22 +6,23 @@ from pathlib import Path try: from whitenoise import WhiteNoise from whitenoise.responders import Redirect, StaticFile -except ImportError as err : - raise ImportError( - "This feature requires the package `whitenoise` to be installed. \n" - + "Run `pip install jinjax[whitenoise]` to do it." - ) from err - +except ImportError: + WhiteNoise = object RX_FINGERPRINT = re.compile("(.*)-([abcdef0-9]{64})") -class ComponentsMiddleware(WhiteNoise): +class ComponentsMiddleware(WhiteNoise): # type: ignore """WSGI middleware for serving components assets""" allowed_ext: tuple[str, ...] def __init__(self, **kwargs) -> None: + if WhiteNoise is object: + raise ImportError( + "The ComponentsMiddleware requires the package `whitenoise`" + + " to be installed. \nRun `pip install jinjax[whitenoise]` to do it." + ) self.allowed_ext = kwargs.pop("allowed_ext", ()) super().__init__(**kwargs) |