Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit b553095

Browse files
committed
Init
1 parent 41e2d8a commit b553095

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

eel/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,20 @@
1818
import pyparsing as pp
1919
import random as rnd
2020
import sys
21-
import pkg_resources as pkg
21+
import importlib_resources
2222
import socket
2323
import mimetypes
2424

2525

2626
mimetypes.add_type('application/javascript', '.js')
27-
_eel_js_file: str = pkg.resource_filename('eel', 'eel.js')
28-
_eel_js: str = open(_eel_js_file, encoding='utf-8').read()
27+
28+
# https://setuptools.pypa.io/en/latest/pkg_resources.html
29+
# Use of pkg_resources is deprecated in favor of importlib.resources
30+
# Migration guide: https://importlib-resources.readthedocs.io/en/latest/migration.html
31+
_eel_js_reference = importlib_resources.files('eel') / 'eel.js'
32+
with importlib_resources.as_file(_eel_js_reference) as _eel_js_path:
33+
_eel_js: str = _eel_js_path.read_text(encoding='utf-8')
34+
2935
_websockets: List[Tuple[Any, WebSocketT]] = []
3036
_call_return_values: Dict[Any, Any] = {}
3137
_call_return_callbacks: Dict[float, Tuple[Callable[..., Any], Optional[Callable[..., Any]]]] = {}

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ gevent-websocket<1.0.0
55
greenlet>=1.0.0,<2.0.0
66
pyparsing>=3.0.0,<4.0.0
77
typing-extensions>=4.3.0
8+
importlib_resources>=1.3

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = typecheck,py{37,38,39,310,311,312}
2+
envlist = typecheck,py{37,38,39,310,311,312,313}
33

44
[pytest]
55
timeout = 30
@@ -12,6 +12,7 @@ python =
1212
3.10: py310
1313
3.11: py311
1414
3.12: py312
15+
3.13: py313
1516

1617

1718
[testenv]

0 commit comments

Comments
 (0)