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

Commit 163d5c3

Browse files
Merge pull request #766 from v01d-gh/drop_pkg_resources
#765 Drop pkg_resources
2 parents 41e2d8a + a5df09f commit 163d5c3

File tree

6 files changed

+17
-6
lines changed

6 files changed

+17
-6
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
os: [ubuntu-20.04, windows-latest, macos-latest]
16+
os: [ubuntu-24.04, windows-latest, macos-latest]
1717
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]
1818
exclude:
1919
- os: macos-latest
2020
python-version: 3.7
21+
- os: ubuntu-24.04
22+
python-version: 3.7
2123

2224
runs-on: ${{ matrix.os }}
2325

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-test.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ webdriver_manager>=4.0.0,<5.0.0
88
mypy>=1.0.0,<2.0.0
99
pyinstaller
1010
types-setuptools
11+
importlib_resources>=1.3

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

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
package_data={
1515
'eel': ['eel.js', 'py.typed'],
1616
},
17-
install_requires=['bottle', 'bottle-websocket', 'future', 'pyparsing', 'typing_extensions'],
17+
install_requires=['bottle', 'bottle-websocket', 'future', 'pyparsing', 'typing_extensions', 'importlib_resources'],
1818
extras_require={
1919
"jinja2": ['jinja2>=2.10']
2020
},

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)