Skip to content

Commit 0c56cd4

Browse files
committed
Revert importlib.metadata entry_points usage for Python 3.8/3.9
Reverts changes from #56 that broke compatibility with Python 3.8/3.9 due to different entry_points() API behavior.
1 parent dce258e commit 0c56cd4

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

matlab_proxy/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import pkgutil
77
import secrets
88
import sys
9-
from importlib import resources
109

1110
import aiohttp
1211
from aiohttp import client_exceptions, web
@@ -498,6 +497,8 @@ def make_static_route_table(app):
498497
Returns:
499498
Dict: Containing information about the static files and header information.
500499
"""
500+
import importlib_resources as resources
501+
501502
from matlab_proxy import gui
502503
from matlab_proxy.gui import static
503504
from matlab_proxy.gui.static import css, js, media

matlab_proxy/util/mwi/validators.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import math
1616
import os
1717
import socket
18-
from importlib import metadata
1918
from pathlib import Path
2019
from typing import List
2120

@@ -215,6 +214,8 @@ def __get_configs():
215214
Dict: Contains all the values present in 'matlab_web_desktop_configs' entry_point from all the packages
216215
installed in the current environment.
217216
"""
217+
import importlib_metadata as metadata
218+
218219
matlab_proxy_eps = metadata.entry_points(group=matlab_proxy.get_entrypoint_name())
219220
configs = {}
220221
for entry_point in matlab_proxy_eps:

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ dependencies = [
3939
"psutil",
4040
"watchdog",
4141
"requests",
42+
"importlib-metadata",
43+
"importlib-resources",
4244
]
4345

4446
[project.urls]

tests/unit/proxy-manager/lib/test_api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import pytest
33

44
from matlab_proxy_manager.lib import api as mpm_api
5-
from matlab_proxy_manager.utils import exceptions
65
from matlab_proxy_manager.storage.server import ServerProcess
6+
from matlab_proxy_manager.utils import exceptions
77

88

99
@pytest.fixture
@@ -62,7 +62,7 @@ async def test_start_matlab_proxy_without_existing_server(mocker):
6262
)
6363
mock_start_subprocess = mocker.patch(
6464
"matlab_proxy_manager.lib.api._start_subprocess",
65-
return_value={1, "url"},
65+
return_value=(1, "url"),
6666
)
6767
mock_check_readiness = mocker.patch(
6868
"matlab_proxy_manager.lib.api._check_for_process_readiness", return_value=None
@@ -112,7 +112,7 @@ async def test_start_matlab_proxy_with_existing_server(mocker, mock_server_proce
112112
)
113113
mock_start_subprocess = mocker.patch(
114114
"matlab_proxy_manager.lib.api._start_subprocess",
115-
return_value={1, "url"},
115+
return_value=(1, "url"),
116116
)
117117

118118
parent_id = "test_parent"

0 commit comments

Comments
 (0)