From 53499b1d7246a74fd1986330d080f969632557b4 Mon Sep 17 00:00:00 2001 From: Robbe Sneyders Date: Sat, 7 Jan 2023 20:11:44 +0100 Subject: [PATCH] Fix path resolving --- py_swagger_ui/__init__.py | 6 +++--- pyproject.toml | 5 +++-- tests/test_can_import.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/py_swagger_ui/__init__.py b/py_swagger_ui/__init__.py index 4cb5366..fa43bda 100644 --- a/py_swagger_ui/__init__.py +++ b/py_swagger_ui/__init__.py @@ -1,9 +1,9 @@ from pathlib import Path try: - import importlib.resources as importlib_resources -except ImportError: # < Python 3.9 import importlib_resources as importlib_resources +except ImportError: # < Python 3.9 + import importlib.resources as importlib_resources -swagger_ui_path: Path = importlib_resources.files("py-swagger-ui") / "vendor/swagger-ui-4.15.5" +swagger_ui_path: Path = importlib_resources.files("py_swagger_ui") / "vendor/swagger-ui-4.15.5" diff --git a/pyproject.toml b/pyproject.toml index 6b38994..a5bbf6a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "py_swagger_ui" -version = 'test' +version = '1.0.0' description = "Swagger UI bundled for usage with Python" readme = "README.rst" keywords = ["swagger-ui"] @@ -31,7 +31,8 @@ classifiers = [ [tool.poetry.dependencies] python = "^3.7" -Jinja2 = "^2.0" +Jinja2 = "^3.0.0" +importlib_resources = { version = "^5.7.1", python = "<3.9" } [tool.poetry.group.test.dependencies] pytest = "^7.1.3" diff --git a/tests/test_can_import.py b/tests/test_can_import.py index d5fc5cd..4c24e41 100644 --- a/tests/test_can_import.py +++ b/tests/test_can_import.py @@ -2,4 +2,4 @@ def test_import_ui(): from py_swagger_ui import swagger_ui_path - open(swagger_ui_path + "/index.html") + open(swagger_ui_path / "index.html")