Skip to content

Commit

Permalink
Fix path resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeSneyders committed Oct 25, 2023
1 parent c1b20cf commit 53499b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions py_swagger_ui/__init__.py
Original file line number Diff line number Diff line change
@@ -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"
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_can_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit 53499b1

Please sign in to comment.