iris-pex-embedded-python 3.4.1b9__py3-none-any.whl → 3.4.1b11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of iris-pex-embedded-python might be problematic. Click here for more details.
- iop/_business_operation.py +0 -1
- iop/_business_process.py +0 -1
- iop/_business_service.py +0 -3
- iop/_common.py +7 -70
- iop/_debugpy.py +97 -21
- iop/cls/IOP/Common.cls +3 -1
- {iris_pex_embedded_python-3.4.1b9.dist-info → iris_pex_embedded_python-3.4.1b11.dist-info}/METADATA +1 -1
- {iris_pex_embedded_python-3.4.1b9.dist-info → iris_pex_embedded_python-3.4.1b11.dist-info}/RECORD +12 -12
- {iris_pex_embedded_python-3.4.1b9.dist-info → iris_pex_embedded_python-3.4.1b11.dist-info}/WHEEL +1 -1
- {iris_pex_embedded_python-3.4.1b9.dist-info → iris_pex_embedded_python-3.4.1b11.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.4.1b9.dist-info → iris_pex_embedded_python-3.4.1b11.dist-info}/licenses/LICENSE +0 -0
- {iris_pex_embedded_python-3.4.1b9.dist-info → iris_pex_embedded_python-3.4.1b11.dist-info}/top_level.txt +0 -0
iop/_business_operation.py
CHANGED
iop/_business_process.py
CHANGED
|
@@ -141,7 +141,6 @@ class _BusinessProcess(_BusinessHost):
|
|
|
141
141
|
def _dispatch_on_init(self, host_object: Any) -> None:
|
|
142
142
|
"""For internal use only."""
|
|
143
143
|
self._restore_persistent_properties(host_object)
|
|
144
|
-
self._debugpy(host_object=host_object)
|
|
145
144
|
create_dispatch(self)
|
|
146
145
|
self.on_init()
|
|
147
146
|
self._save_persistent_properties(host_object)
|
iop/_business_service.py
CHANGED
iop/_common.py
CHANGED
|
@@ -8,6 +8,8 @@ from . import _iris
|
|
|
8
8
|
|
|
9
9
|
from iop._log_manager import LogManager, logging
|
|
10
10
|
|
|
11
|
+
from iop._debugpy import debugpython
|
|
12
|
+
|
|
11
13
|
class _Common(metaclass=abc.ABCMeta):
|
|
12
14
|
"""Base class that defines common methods for all component types.
|
|
13
15
|
|
|
@@ -59,78 +61,8 @@ class _Common(metaclass=abc.ABCMeta):
|
|
|
59
61
|
|
|
60
62
|
def _dispatch_on_init(self, host_object: Any) -> None:
|
|
61
63
|
"""Initialize component when started."""
|
|
62
|
-
self._debugpy(host_object)
|
|
63
64
|
self.on_init()
|
|
64
65
|
|
|
65
|
-
def _debugpy(self, host_object: Any) -> None:
|
|
66
|
-
"""Enable debugpy for debugging purposes."""
|
|
67
|
-
# iris.cls('%SYS.Python').Debugging(1)
|
|
68
|
-
from iop._debugpy import enable_debugpy, wait_for_debugpy_connected, find_free_port, is_debugpy_installed
|
|
69
|
-
import sys, os
|
|
70
|
-
|
|
71
|
-
# hack to set __file__ for os module in debugpy
|
|
72
|
-
# This is a workaround for the issue where debugpy cannot find the __file__ attribute of the os module.
|
|
73
|
-
if not hasattr(os, '__file__'):
|
|
74
|
-
setattr(os, '__file__', __file__)
|
|
75
|
-
|
|
76
|
-
if host_object is not None:
|
|
77
|
-
port = host_object.port
|
|
78
|
-
timeout = host_object.timeout
|
|
79
|
-
enabled = host_object.enable
|
|
80
|
-
python_interpreter_path = host_object.PythonInterpreterPath
|
|
81
|
-
else:
|
|
82
|
-
self.log_alert("No host object found, cannot enable debugpy.")
|
|
83
|
-
return
|
|
84
|
-
|
|
85
|
-
if python_interpreter_path != "":
|
|
86
|
-
# the user has set a specific python interpreter path, so we need to set the path to the python executable
|
|
87
|
-
# to the one that is running this script
|
|
88
|
-
if os.path.exists(python_interpreter_path):
|
|
89
|
-
sys.executable = python_interpreter_path
|
|
90
|
-
else:
|
|
91
|
-
self.log_alert(f"Python path {python_interpreter_path} does not exist, cannot set python path for debugpy.")
|
|
92
|
-
return
|
|
93
|
-
elif sys.executable.find('irisdb') > 0:
|
|
94
|
-
# the executable is the IRIS executable, so we need to set the path to the python executable
|
|
95
|
-
# to the one that is running this script
|
|
96
|
-
installdir = os.environ.get('IRISINSTALLDIR') or os.environ.get('ISC_PACKAGE_INSTALLDIR')
|
|
97
|
-
if installdir is not None:
|
|
98
|
-
if sys.platform == 'win32':
|
|
99
|
-
python_path = os.path.join(installdir, 'bin', 'irispython.exe')
|
|
100
|
-
else:
|
|
101
|
-
python_path = os.path.join(installdir, 'bin', 'irispython')
|
|
102
|
-
if os.path.exists(python_path):
|
|
103
|
-
sys.executable = python_path
|
|
104
|
-
else:
|
|
105
|
-
self.log_alert(f"Python path {python_path} does not exist, cannot set python path for debugpy.")
|
|
106
|
-
return
|
|
107
|
-
else:
|
|
108
|
-
self.log_alert("IRISINSTALLDIR or ISC_PACKAGE_INSTALLDIR not set, cannot set python path for debugpy.")
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
if enabled:
|
|
112
|
-
self.log_info(f"Debugpy is running in {sys.executable}.")
|
|
113
|
-
if is_debugpy_installed():
|
|
114
|
-
if port is None or port <= 0:
|
|
115
|
-
port = find_free_port()
|
|
116
|
-
self.log_info(f"Debugpy enabled.")
|
|
117
|
-
try:
|
|
118
|
-
enable_debugpy(port=port, address=None)
|
|
119
|
-
except Exception as e:
|
|
120
|
-
self.log_alert(f"Error enabling debugpy: {e}")
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
self.trace(f"Waiting for {timeout} sec to debugpy connection on port {port}...")
|
|
124
|
-
if wait_for_debugpy_connected(timeout=timeout, port=port):
|
|
125
|
-
self.log_info("Debugpy connected.")
|
|
126
|
-
else:
|
|
127
|
-
self.log_alert(f"Debugpy connection timed out after {timeout} seconds.")
|
|
128
|
-
else:
|
|
129
|
-
self.log_alert("Debugpy is not installed.")
|
|
130
|
-
else:
|
|
131
|
-
self.log_info("Debugpy is not enabled.")
|
|
132
|
-
|
|
133
|
-
|
|
134
66
|
def _dispatch_on_tear_down(self, host_object: Any) -> None:
|
|
135
67
|
self.on_tear_down()
|
|
136
68
|
|
|
@@ -138,6 +70,11 @@ class _Common(metaclass=abc.ABCMeta):
|
|
|
138
70
|
"""Internal method to set IRIS handles."""
|
|
139
71
|
pass
|
|
140
72
|
|
|
73
|
+
def _debugpy(self, host) -> None:
|
|
74
|
+
"""Set up debugpy for debugging."""
|
|
75
|
+
if debugpython is not None:
|
|
76
|
+
debugpython(self=self, host_object=host)
|
|
77
|
+
|
|
141
78
|
# Component information methods
|
|
142
79
|
@classmethod
|
|
143
80
|
def _get_info(cls) -> List[str]:
|
iop/_debugpy.py
CHANGED
|
@@ -3,9 +3,10 @@ import threading
|
|
|
3
3
|
import time
|
|
4
4
|
import contextlib
|
|
5
5
|
import socket
|
|
6
|
+
import os
|
|
7
|
+
import sys
|
|
6
8
|
from contextlib import closing
|
|
7
|
-
|
|
8
|
-
from typing import Optional, Tuple, Union, Sequence, cast, Callable, TypeVar, Dict, Any
|
|
9
|
+
from typing import Optional, cast, Any, Dict
|
|
9
10
|
|
|
10
11
|
def find_free_port(start: Optional[int] = None, end: Optional[int] = None) -> int:
|
|
11
12
|
port = start
|
|
@@ -32,38 +33,113 @@ def find_free_port(start: Optional[int] = None, end: Optional[int] = None) -> in
|
|
|
32
33
|
return find_free_port(None)
|
|
33
34
|
raise
|
|
34
35
|
|
|
35
|
-
|
|
36
36
|
def is_debugpy_installed() -> bool:
|
|
37
37
|
try:
|
|
38
38
|
__import__("debugpy")
|
|
39
|
+
return True
|
|
39
40
|
except ImportError:
|
|
40
41
|
return False
|
|
41
|
-
return True
|
|
42
42
|
|
|
43
|
+
def _get_python_interpreter_path(install_dir: Optional[str]) -> Optional[str]:
|
|
44
|
+
"""Get the path to the Python interpreter."""
|
|
45
|
+
if not install_dir:
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
python_exe = 'irispython.exe' if sys.platform == 'win32' else 'irispython'
|
|
49
|
+
python_path = os.path.join(install_dir, 'bin', python_exe)
|
|
50
|
+
|
|
51
|
+
return python_path if os.path.exists(python_path) else None
|
|
52
|
+
|
|
53
|
+
def _get_debugpy_config(python_path: str) -> Dict[str, str]:
|
|
54
|
+
"""Get the debugpy configuration."""
|
|
55
|
+
return {"python": python_path}
|
|
56
|
+
|
|
57
|
+
def configure_debugpy(self, python_path: Optional[str] = None) -> bool:
|
|
58
|
+
"""Configure debugpy with the appropriate Python interpreter."""
|
|
59
|
+
import debugpy
|
|
60
|
+
|
|
61
|
+
if not python_path:
|
|
62
|
+
install_dir = os.environ.get('IRISINSTALLDIR') or os.environ.get('ISC_PACKAGE_INSTALLDIR')
|
|
63
|
+
python_path = _get_python_interpreter_path(install_dir)
|
|
64
|
+
|
|
65
|
+
if not python_path:
|
|
66
|
+
self.log_alert("Could not determine Python interpreter path")
|
|
67
|
+
return False
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
debugpy.configure(_get_debugpy_config(python_path))
|
|
71
|
+
self.log_info(f"Debugpy configured with Python interpreter: {python_path}")
|
|
72
|
+
return True
|
|
73
|
+
except Exception as e:
|
|
74
|
+
self.log_alert(f"Failed to configure debugpy: {e}")
|
|
75
|
+
return False
|
|
43
76
|
|
|
44
|
-
def wait_for_debugpy_connected(timeout: float = 30,port=0) -> bool:
|
|
45
|
-
|
|
77
|
+
def wait_for_debugpy_connected(timeout: float = 30, port: int = 0) -> bool:
|
|
78
|
+
"""Wait for debugpy client to connect."""
|
|
79
|
+
import debugpy
|
|
46
80
|
|
|
47
81
|
if not is_debugpy_installed():
|
|
48
82
|
return False
|
|
49
83
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return
|
|
84
|
+
def timeout_handler():
|
|
85
|
+
time.sleep(timeout)
|
|
86
|
+
debugpy.wait_for_client.cancel()
|
|
87
|
+
|
|
88
|
+
threading.Thread(target=timeout_handler, daemon=True).start()
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
debugpy.wait_for_client()
|
|
92
|
+
return debugpy.is_client_connected()
|
|
93
|
+
except Exception:
|
|
94
|
+
import pydevd # type: ignore
|
|
95
|
+
pydevd.stoptrace()
|
|
96
|
+
return False
|
|
59
97
|
|
|
60
|
-
|
|
98
|
+
def enable_debugpy(port: int, address: str = "0.0.0.0") -> None:
|
|
99
|
+
"""Enable debugpy server on specified port and address."""
|
|
100
|
+
import debugpy
|
|
101
|
+
debugpy.listen((address, port))
|
|
61
102
|
|
|
62
|
-
def
|
|
103
|
+
def debugpython(self, host_object: Any) -> None:
|
|
104
|
+
"""Enable and configure debugpy for debugging purposes."""
|
|
105
|
+
# hack to set __file__ for os module in debugpy
|
|
106
|
+
# This is a workaround for the issue where debugpy cannot find the __file__ attribute of the os module.
|
|
107
|
+
if not hasattr(os, '__file__'):
|
|
108
|
+
setattr(os, '__file__', __file__)
|
|
63
109
|
|
|
64
|
-
import debugpy # noqa: T100
|
|
65
110
|
|
|
66
|
-
if
|
|
67
|
-
|
|
111
|
+
if host_object is None:
|
|
112
|
+
self.log_alert("No host object found, cannot enable debugpy.")
|
|
113
|
+
return
|
|
68
114
|
|
|
69
|
-
|
|
115
|
+
if host_object.enable != 1:
|
|
116
|
+
self.log_info("Debugpy is not enabled.")
|
|
117
|
+
return
|
|
118
|
+
|
|
119
|
+
if not is_debugpy_installed():
|
|
120
|
+
self.log_alert("Debugpy is not installed.")
|
|
121
|
+
return
|
|
122
|
+
|
|
123
|
+
# Configure Python interpreter
|
|
124
|
+
if host_object.PythonInterpreterPath != '':
|
|
125
|
+
success = configure_debugpy(self, host_object.PythonInterpreterPath)
|
|
126
|
+
else:
|
|
127
|
+
success = configure_debugpy(self)
|
|
128
|
+
|
|
129
|
+
if not success:
|
|
130
|
+
return
|
|
131
|
+
|
|
132
|
+
# Setup debugging server
|
|
133
|
+
port = host_object.port if host_object.port and host_object.port > 0 else find_free_port()
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
enable_debugpy(port=port)
|
|
137
|
+
self.log_info(f"Debugpy enabled on port {port}")
|
|
138
|
+
|
|
139
|
+
self.trace(f"Waiting {host_object.timeout} seconds for debugpy connection...")
|
|
140
|
+
if wait_for_debugpy_connected(timeout=host_object.timeout, port=port):
|
|
141
|
+
self.log_info("Debugpy connected successfully")
|
|
142
|
+
else:
|
|
143
|
+
self.log_alert(f"Debugpy connection timed out after {host_object.timeout} seconds")
|
|
144
|
+
except Exception as e:
|
|
145
|
+
self.log_alert(f"Error enabling debugpy: {e}")
|
iop/cls/IOP/Common.cls
CHANGED
|
@@ -40,7 +40,9 @@ Method GetModule() As %String
|
|
|
40
40
|
Method %OnNew(pConfigName As %String) As %Status
|
|
41
41
|
{
|
|
42
42
|
$$$ThrowOnError(..Connect())
|
|
43
|
-
|
|
43
|
+
$$$ThrowOnError($method($this,"initConfig",.pConfigName)) ; call subclass
|
|
44
|
+
do ..%class."_debugpy"($this)
|
|
45
|
+
Quit $$$OK
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
Method OnInit() As %Status
|
{iris_pex_embedded_python-3.4.1b9.dist-info → iris_pex_embedded_python-3.4.1b11.dist-info}/RECORD
RENAMED
|
@@ -31,12 +31,12 @@ iop/__init__.py,sha256=1C589HojSVK0yJf1KuTPA39ZjrOYO0QFLv45rqbZpA4,1183
|
|
|
31
31
|
iop/__main__.py,sha256=pQzVtkDhAeI6dpNRC632dVk2SGZZIEDwDufdgZe8VWs,98
|
|
32
32
|
iop/_async_request.py,sha256=ae950UFSlOHjmXGifbjHV4SFiJAMefrTVLs6lGEkgXE,2242
|
|
33
33
|
iop/_business_host.py,sha256=x9wMNfs_IXBczEeGHsrnAo8mgFrlAhwtrWkSC-W9vqA,9699
|
|
34
|
-
iop/_business_operation.py,sha256=
|
|
35
|
-
iop/_business_process.py,sha256=
|
|
36
|
-
iop/_business_service.py,sha256=
|
|
34
|
+
iop/_business_operation.py,sha256=ml4BIn1BfrGx8AUGISFR71DZIUCP8vZ2yn9SQjaSzTM,3038
|
|
35
|
+
iop/_business_process.py,sha256=hj6nDIP5Mz5UYbm0vDjvs9lPSEYVQxGJl6tQRcDGTBk,8548
|
|
36
|
+
iop/_business_service.py,sha256=wdhEKkqNHWt09XYGrvIpSuDDI4MyCGm2rKdvGQJ93EI,3988
|
|
37
37
|
iop/_cli.py,sha256=fhaUpq3rTb4P2QPuuqoeatsphMLBPj9xtbvFPJv-2Mo,7941
|
|
38
|
-
iop/_common.py,sha256=
|
|
39
|
-
iop/_debugpy.py,sha256
|
|
38
|
+
iop/_common.py,sha256=YJrEAsf0xT-nGsCYPARwg4jrSGTYuMfMe56A8GJ46oA,13754
|
|
39
|
+
iop/_debugpy.py,sha256=HAZOBuYGsVi4bQ8cV1Bas0dbH9stcs_dGDSVJJ2QqfE,4702
|
|
40
40
|
iop/_decorators.py,sha256=ZpgEETLdKWv58AoSMfXnm3_mA-6qPphIegjG-npDgwg,2324
|
|
41
41
|
iop/_director.py,sha256=d1XXJn8T8VF9rmT-joJdz_ElS2UR6myRaXaMFC_2brA,11498
|
|
42
42
|
iop/_dispatch.py,sha256=I3TAhvTuk8j4VcROI9vAitJ0a7Nk1BYAWKRrLeNsjr0,3203
|
|
@@ -53,7 +53,7 @@ iop/_utils.py,sha256=zguWjvZQkzAScHXl4OomZr2ZtPljDqVAs1CFllQZn5g,20092
|
|
|
53
53
|
iop/cls/IOP/BusinessOperation.cls,sha256=lrymqZ8wHl5kJjXwdjbQVs5sScV__yIWGh-oGbiB_X0,914
|
|
54
54
|
iop/cls/IOP/BusinessProcess.cls,sha256=s3t38w1ykHqM26ETcbCYLt0ocjZyVVahm-_USZkuJ1E,2855
|
|
55
55
|
iop/cls/IOP/BusinessService.cls,sha256=7ebn32J9PiZXUgXuh5Xxm_7X6zHBiqkJr9c_dWxbPO8,1021
|
|
56
|
-
iop/cls/IOP/Common.cls,sha256=
|
|
56
|
+
iop/cls/IOP/Common.cls,sha256=yq3HskJOuX-jMtU6UW2EwhU9ur1m-v9ZLtTYu4lp5zw,11416
|
|
57
57
|
iop/cls/IOP/Director.cls,sha256=M43LoTb6lwSr0J81RFxi1YLW1mwda09wQ7Xqr3nBtxo,2008
|
|
58
58
|
iop/cls/IOP/InboundAdapter.cls,sha256=GeoCm6q5HcLJ5e4VxgqXiErJXqolBbpKwpunaNzpvjU,610
|
|
59
59
|
iop/cls/IOP/Message.cls,sha256=ZrYQHosgfTG9wv7i-WQ8j71YXZMmL4_mN16xtIDwcRg,25180
|
|
@@ -72,9 +72,9 @@ iop/cls/IOP/PrivateSession/Message/Start.cls,sha256=uk-WTe66GicCshgmVy3F5ugHiAyP
|
|
|
72
72
|
iop/cls/IOP/PrivateSession/Message/Stop.cls,sha256=7g3gKFUjNg0WXBLuWnj-VnCs5G6hSE09YTzGEp0zbGc,1390
|
|
73
73
|
iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,10440
|
|
74
74
|
iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
|
|
75
|
-
iris_pex_embedded_python-3.4.
|
|
76
|
-
iris_pex_embedded_python-3.4.
|
|
77
|
-
iris_pex_embedded_python-3.4.
|
|
78
|
-
iris_pex_embedded_python-3.4.
|
|
79
|
-
iris_pex_embedded_python-3.4.
|
|
80
|
-
iris_pex_embedded_python-3.4.
|
|
75
|
+
iris_pex_embedded_python-3.4.1b11.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
76
|
+
iris_pex_embedded_python-3.4.1b11.dist-info/METADATA,sha256=bem1ObaaQxBoN5RVcrtCe7d0ERQr_OJBxbXA7GcPPVo,4450
|
|
77
|
+
iris_pex_embedded_python-3.4.1b11.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
|
|
78
|
+
iris_pex_embedded_python-3.4.1b11.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
|
|
79
|
+
iris_pex_embedded_python-3.4.1b11.dist-info/top_level.txt,sha256=4p0q6hCATmYIVMVi3I8hOUcJE1kwzyBeHygWv_rGvrU,13
|
|
80
|
+
iris_pex_embedded_python-3.4.1b11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|